New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

quri

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quri

JS wrapper for the QURI string specification

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-83.33%
Maintainers
2
Weekly downloads
 
Created
Source

quri-js

NPM version Build Status Coveralls Status Dependency Status Downloads

JS wrapper for the QURI string specification

Install

npm install quri

QURI Spec

More information about the QURI specification and parser is available here.

Usage

Basic example

import Quri from 'quri';

const quri = new Quri();

quri.toString(); // "field_1".eq("my value")

Nested example

import Quri from 'quri';

const quri = new Quri();

quri.appendExpression('field_1', '==', 'outer');

const nestedQuri = new Quri('or');

nestedQuri.appendExpression('field_2', 'like', 'nested%');
nestedQuri.appendExpression('field_3', 'in', [1, 2, 3, 4]);

quri.appendCriteria(nestedQuri);

quri.toString();
// "field_1".eq("outer"),("field_2".eq("nested%")|"field_3".in(1,2,3,4))

Serialization

import Quri from 'quri';

let quri = new Quri();

quri.appendExpression('field_1', '==', 'my value');

quri.serialize();
// { criteria: [ [ 'field_1', '==', 'my value' ] ] }
quri.serialize({ verbose: true });
// { conjunction: 'and', criteria: [ { field: 'field_1', operator: '==', value: 'my value' } ] }
quri.conjunction
// and
quri.criteria
// [ { field: 'field_1', operator: '==', value: 'my value' } ]

quri = Quri.deserialize({ criteria: [ [ 'field_1', '==', 'my value' ] ] })
quri.toString();
// "field_1".eq("my value")

quri = Quri.deserialize({ criteria: [ { field: 'field_1', operator: '==', value: 'my value' } ] });
quri.toString();
// "field_1".eq("my value")

quri = Quri.deserialize({ conjunction: 'or', criteria: [
  [ 'field_1', '==', 'my value' ],
  [ 'field_2', '==', 'my value 2' ]
] })
quri.toString();
// "field_1".eq("my value")|"field_2".eq("my value 2")

quri = Quri.deserialize({ conjunction: 'or', criteria: [
  { field: 'field_1', operator: '==', value: 'my value' },
  { field: 'field_2', operator: '==', value: 'my value 2' }
] })
quri.toString();
// "field_1".eq("my value")|"field_2".eq("my value 2")

License

MIT © theHarvester

Keywords

FAQs

Package last updated on 31 Aug 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc