Socket
Socket
Sign inDemoInstall

@ambassify/aql-condition

Package Overview
Dependencies
18
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ambassify/aql-condition

AQL condition tool


Version published
Weekly downloads
18
decreased by-63.27%
Maintainers
1
Created
Weekly downloads
 

Readme

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

Last updated on 08 Sep 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc