web_reader / build /utils /misc.js
Mohammad Shahid
Include pre-built files for HF deployment
f316cce
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanAttribute = cleanAttribute;
exports.tryDecodeURIComponent = tryDecodeURIComponent;
exports.toAsyncGenerator = toAsyncGenerator;
exports.toGenerator = toGenerator;
const civkit_1 = require("civkit");
function cleanAttribute(attribute) {
return attribute ? attribute.replace(/(\n+\s*)+/g, '\n') : '';
}
function tryDecodeURIComponent(input) {
try {
return decodeURIComponent(input);
}
catch (err) {
if (URL.canParse(input, 'http://localhost:3000')) {
return input;
}
throw new civkit_1.ParamValidationError(`Invalid URIComponent: ${input}`);
}
}
async function* toAsyncGenerator(val) {
yield val;
}
async function* toGenerator(val) {
yield val;
}
//# sourceMappingURL=misc.js.map