expr-eval icon indicating copy to clipboard operation
expr-eval copied to clipboard

Mathematical expression evaluator in JavaScript

Results 59 expr-eval issues
Sort by recently updated
recently updated
newest added

Consider adding support for an "implied multiplication" operator. For example, these would be equivalent: ``` 4x + 1 = 4*x + 1 a x + b = a*x + b...

parser

We could use some benchmarks to test for performance regressions and to find areas to optimize.

build
in-progress

This commit adds a new function ´clamp´ to the codebase. The clamp function takes a minimum value, a maximum value, and a value to be clamped, and returns the clamped...

there should be [more constants](https://en.wikipedia.org/wiki/Mathematical_constant#Table_of_selected_mathematical_constants), like `C` (km/s Speed of light value on air).

Although we already have `module: dist/index.mjs`, Node.js doesn't recognize the "module" field. Instead, we should use "exports" to increase compatibility with it. So we can use it on the server...

# Parse Problem Repro: ```javascript // fails with '*' (new require('expr-eval').Parser).parse("length * width") // fails with '/' (new require('expr-eval').Parser).parse("length / width") ``` Throws error: ```shell Uncaught Error: unexpected TOP: *...

In case anyone needs to whitelist only selected operators without explicitly setting `false` for every other: ```ts const ALLOWED_OPERATORS = ['add', 'subtract', 'multiply', 'divide', 'power']; const parser = new Parser({...