0.4.1 • Published 9 years ago
@collinbrewer/expression v0.4.1
Expression
A utility for node and browser that evaluates objects against an expression.
Install
npm install @collinbrewer/expression -SUsage
var Expression=require("expression");Constants:
Expression.parse("'Value'").getValueWithObject(); // -> 'Value'
Expression.parse("4").getValueWithObject(); // -> 4Functions:
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