How to use the @sqs/jsonc-parser/lib/main.parse function in @sqs/jsonc-parser

To help you get started, we’ve selected a few @sqs/jsonc-parser 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 sourcegraph / sourcegraph / shared / src / util / jsonc.ts View on Github external
function parseJSON(input: string): any {
    const errors: ParseError[] = []
    const o = parse(input, errors, { allowTrailingComma: true, disallowComments: false })
    if (errors.length > 0) {
        throw createAggregateError(
            errors.map(v => ({
                ...v,
                code: ParseErrorCode[v.error],
                message: `parse error (code: ${v.error}, offset: ${v.offset}, length: ${v.length})`,
            }))
        )
    }
    return o
}

@sqs/jsonc-parser

Scanner and parser for JSON with comments.

MIT
Latest version published 6 years ago

Package Health Score

56 / 100
Full package analysis

Similar packages