How to use the userscript-metadata.validateAndStringifyWith function in userscript-metadata

To help you get started, we’ve selected a few userscript-metadata examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SimonAlling / userscripter / .userscripter / build / metadata.ts View on Github external
export function process(metadata: Metadata): {
    stringified: string
    warnings: ReadonlyArray
} {
    const result = validateAndStringifyWith({
        items: ITEMS,
        warnings: WARNINGS,
        underscoresAsHyphens: UNDERSCORES_AS_HYPHENS,
    })(metadata);
    if (isRight(result)) {
        return result.Right;
    } else {
        throw new MetadataException(result.Left);
    }
}