Socket
Socket
Sign inDemoInstall

@ambassify/aql-condition

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ambassify/aql-condition

AQL condition tool


Version published
Weekly downloads
28
increased by75%
Maintainers
1
Weekly downloads
 
Created
Source

aql-condition

Tool to help you build AQL conditions in code.

Usage

npm install --save @ambassify/aql-condition
const Condition = require('@ambassify/aql-condition');

Normalize

Get an normalized version of your condition. This function tries to strip as much irrelevant parts of your condition as it can detect.

condition = Condition.normalize(condition);

Parse

Parse a condition string and normalize it.

const url = `https://foo.com/?condition=${encodeURIComponent(JSON.stringify(condition))}`;
const condition = Condition.parse(url);

Filter

Get a subcondition of a condition by recursively filtering out only the parts you are interested in.

E.g. if you only want parts of the condition that target the "foo" key:

condition = Condition.filter(condition, c => c.key === 'foo');

And / Or / Not

Easily construct normalized and/or/not conditions.

condition = Condition.and(condition, extraCondition);
condition = Condition.or(condition, anotherCondition);
condition = Condtion.and(a, b, c, d, asMuchAsYouWant);
negated = Condition.not(condition);

FAQs

Package last updated on 26 Mar 2021

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