How to use groq-js - 2 common examples

To help you get started, we’ve selected a few groq-js 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 sanity-io / groq-cli / src / cli.js View on Github external
if (isNdjson) {
    outputFormat = 'ndjson'
    inputFormat = 'ndjson'
  }

  check({ query, inputFormat, outputFormat })

  // Parse query
  const tree = parse(query)

  // Read input
  const inputter = INPUTTERS[inputFormat]
  const options = await inputter()

  // Execute query
  const result = await evaluate(tree, options)

  // Stream output
  const streamer = OUTPUTTERS[outputFormat]
  yield* await streamer(result)
}
github sanity-io / groq-cli / src / cli.js View on Github external
const query = input[0]

  if (pretty) {
    outputFormat = 'pretty'
  }

  if (isNdjson) {
    outputFormat = 'ndjson'
    inputFormat = 'ndjson'
  }

  check({ query, inputFormat, outputFormat })

  // Parse query
  const tree = parse(query)

  // Read input
  const inputter = INPUTTERS[inputFormat]
  const options = await inputter()

  // Execute query
  const result = await evaluate(tree, options)

  // Stream output
  const streamer = OUTPUTTERS[outputFormat]
  yield* await streamer(result)
}

groq-js

[![npm stat](https://img.shields.io/npm/dm/groq-js.svg?style=flat-square)](https://npm-stat.com/charts.html?package=groq-js) [![npm version](https://img.shields.io/npm/v/groq-js.svg?style=flat-square)](https://www.npmjs.com/package/groq-js) [![gzip size][

MIT
Latest version published 13 days ago

Package Health Score

86 / 100
Full package analysis

Popular groq-js functions