Spaces:
Build error
Build error
File size: 621 Bytes
0e8308e 2b29679 7ee2c32 0e8308e e9d69e6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import { ParamValidationError } from 'civkit';
export function cleanAttribute(attribute: string | null) {
return attribute ? attribute.replace(/(\n+\s*)+/g, '\n') : '';
}
export function tryDecodeURIComponent(input: string) {
try {
return decodeURIComponent(input);
} catch (err) {
if (URL.canParse(input, 'http://localhost:3000')) {
return input;
}
throw new ParamValidationError(`Invalid URIComponent: ${input}`);
}
}
export async function* toAsyncGenerator<T>(val: T) {
yield val;
}
export async function* toGenerator<T>(val: T) {
yield val;
} |