Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
groq-js
Advanced tools
Changelog
Readme
GROQ-JS is a JavaScript implementation of GROQ which follows the official specification.
import {parse, evaluate} from 'groq-js'
let input = '*[_type == "user"]{name}'
// Returns an ESTree-inspired syntax tree
let tree = parse(input)
let dataset = [
{_type: 'user', name: 'Michael'},
{_type: 'company', name: 'Bluth Company'},
]
// Evaluate a tree against a dataset
let value = await evaluate(tree, {dataset})
// Gather everything into one JavaScript object
let result = await value.get()
console.log(result)
Table of contents:
npm i groq-js
yarn add groq-js
pnpm install groq-js
See API.md for the public API.
The GROQ spec version is independent of the groq-js library version. When you import groq-js you need to be explicit on which GROQ version you want to use. The GROQ version is tied to the groq-spec. This allows us to update the library and its API independent of the GROQ version.
GROQ-JS follows SemVer. See the changelog for recent changes. This is an "experimental" release and anything may change at any time, but we're trying to keep changes as minimal as possible:
Run the "CI & Release" workflow. Make sure to select the main branch and check "Release new version".
Version will be automatically bumped based on conventional commits since the last release.
Semantic release will only release on configured branches, so it is safe to run release on any branch.
Note: commits with chore:
will be ignored. If you want updated dependencies to trigger
a new version, use fix(deps):
instead.
MIT © Sanity.io
Tests are written in Jest:
# Install dependencies
npm i
# Run tests
npm test
You can also generate tests from the official GROQ test suite:
# Fetch and generate test file:
./test/generate.sh
# Run tests as usual:
npm test
You can generate tests from a specific version:
GROQTEST_SUITE_VERSION=v0.1.33 ./test/generate.sh
or from a file (as generated by the test suite):
GROQTEST_SUITE=suite.ndjson ./test/generate.sh
The test arguments are passed to tap
, so you can use arguments, e.g. to run a specific set of tests:
npm test -g "array::join"
FAQs
[![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][
The npm package groq-js receives a total of 137,622 weekly downloads. As such, groq-js popularity was classified as popular.
We found that groq-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 48 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.