New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

where-clause-evaluate

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

where-clause-evaluate

A tool for evaluating where clauses

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

where clause evaluate

Where clause parser, compiler, evaluator - A javascript tool to evaluate where clauses against objects in Ember.js

Works like so:

var Where = require("where-clause-evaluate");

var record = { firstName : 'Rudolf', nickName : 'Rednose', lastName : 'Reindeer', isEnlightening : true };

var evaluate = Where.newEvaluator({ cache : true }); // { cache : true }, so that the same clause doesn't get compiled more than once

console.log("We have an enlightening rednose amongst ourselves : " + evaluate(record, 'where firstName = "Rudolf" and isEnlightening = true'));

Supports precedence -> meaning brackets, and the operators/operations:

=, !=, <, <=, >, >=, in (for constant arrays), and, or, not <- all case sensitive

see the file js/lib/anlr4/parsers/where/Where.g4 for the grammar

I'm currently using this as a where clause/query evaluator for an Ember.js local datastorage adapter

As the project is based on antlr - the compiler is quickly rewritten in java, .net or C and made to execute against an sql, nosql or orm where clause

Thanks goes to the antlr4 dudes for creating such a great tool for creating parsers: www.antlr.org

Keywords

where

FAQs

Package last updated on 30 May 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