expr-eval
Advanced tools
Changelog
[2.0.2] - 2019-09-28
import { Parser } from 'expr-eval'
to work in TypeScript. The default export is still available for backward compatibility.Changelog
[2.0.1] - 2019-09-10
if(condition, trueValue, falseValue)
function back. The ternary operator is still recommended if you need to only evaluate one branch, but we're keep this as an option at least for now.Changelog
[2.0.0] - 2019-09-07
[ 1, 2, 3 ]
and indexing: array[0]
join
, indexOf
, map
, filter
, and fold
x = 4
myfunction(x, y) = x * y
;
log2
(base-2 logarithm), cbrt
(cube root), expm1
(e^x - 1
), log1p
(log(1 + x)
), sign
(essentially x == 0 ? 0 : x / abs x
)min
and max
functions accept either a parameter list or a single array argumentin
operator is enabled by default. It can be disabled by passing { operators: { 'in': false } }
to the Parser
constructor.||
(concatenation operator) now supports strings and arraysif(condition, trueValue, falseValue)
function. Use the ternary conditional operator instead: condition ? trueValue : falseValue
, or you can add it back easily with a custom function.