How to use the @sqs/jsonc-parser.parseTree 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 / e2e / driver.ts View on Github external
export function modifyJSONC(text: string, path: jsonc.JSONPath, f: (oldValue: jsonc.Node | undefined) => any): any {
    const old = jsonc.findNodeAtLocation(jsonc.parseTree(text), path)
    return jsonc.applyEdits(
        text,
        jsoncEdit.setProperty(text, path, f(old), {
            eol: '\n',
            insertSpaces: true,
            tabSize: 2,
        })
    )
}

@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