mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Add typings for expr-eval * Avoid use of Function type * Use (slightly) stricter typings for expr-eval * Update with more PR comments * Disable linter due to bugs, allow CI to pass
15 lines
443 B
TypeScript
15 lines
443 B
TypeScript
import { Parser, Expression } from 'expr-eval';
|
|
|
|
const expr = Parser.parse('2^2');
|
|
Parser.evaluate('2^2');
|
|
Parser.evaluate('2^x', { x: 2 });
|
|
Parser.evaluate('x.toUpperCase()', { x: 'hello world' });
|
|
|
|
expr.evaluate({ x: 3 });
|
|
expr.simplify();
|
|
expr.simplify({ x: 2 });
|
|
expr.variables().forEach(str => str.toUpperCase());
|
|
expr.symbols().forEach(str => str.toUpperCase());
|
|
expr.toJSFunction('y, x');
|
|
expr.toJSFunction('y, z', { y: 2 })({ z: 3 });
|