How to use node-jq - 3 common examples

To help you get started, we’ve selected a few node-jq 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 wellsjo / JSON-Splora / app / js / Editor.js View on Github external
try {
      new vm.Script(script).runInNewContext(context)
      if (typeof context.result !== 'undefined') {
        this.emit('filter-valid', {
          result: context.result,
          type: 'js'
        })
      } else {
        this.emit('filter-invalid')
      }
    } catch (e) {
      fs.writeFileSync(this.tmp, JSON.stringify(this.data))

      // If JavaScript filter fails, run through jq
      jq.run(filter, this.tmp, {
        input: 'file',
        output: 'json'
      }).then((result) => {
        if (result === null) {

          // jq returns null for incorrect keys, but we will count them as
          // invalid
          this.emit('filter-invalid')
        } else {

          // The jq filter worked
          this.emit('filter-valid', {
            type: 'jq',
            result
          })
        }
github syndesisio / syndesis / ux / connections_icons / svg / update_icons.js View on Github external
            () => jq.run('.', descriptorFile, { sort: true }).then(out => fs.writeFileSync(descriptorFile, out + '\n'))
          )
github syndesisio / syndesis / ux / connections_icons / svg / update_icons.js View on Github external
          () => jq.run('.', DEPLOYMENT_JSON, { sort: true }).then(out => fs.writeFileSync(DEPLOYMENT_JSON, out + '\n'))
        )

node-jq

Run jq in node

MIT
Latest version published 3 months ago

Package Health Score

78 / 100
Full package analysis

Popular node-jq functions