@collinbrewer/expression

0.4.1 • Public • Published

Expression

npm CircleCI Code Climate Code Climate David

A utility for node and browser that evaluates objects against an expression.

Install

npm install @collinbrewer/expression -S

Usage

var Expression=require("expression");

Constants:

Expression.parse("'Value'").getValueWithObject(); // -> 'Value'
Expression.parse("4").getValueWithObject(); // -> 4

Functions:

var doc={firstName:"Chris", lastName:"Ericson"}
Expression.parse("concat('firstName', ' ', 'lastName')").getValueWithObject(doc); // -> "Chris Ericson"

Arithmetic:

Expression.parse("1+2+3").getValueWithObject(); // -> 6
Expression.parse("multiply(2, 6)"); // -> 12

Readme

Keywords

none

Package Sidebar

Install

npm i @collinbrewer/expression

Weekly Downloads

2

Version

0.4.1

License

ISC

Last publish

Collaborators

  • collinbrewer