js-expr-eval
v0.0.1
Published
expr-eval alternative — redirects to a-calc, a modern precision math expression evaluator
Maintainers
Readme
expr-eval
This package is no longer maintained. Please use a-calc instead — a modern and actively maintained alternative for math expression evaluation and precision arithmetic.
Migration
npm install a-calca-calc Basic Usage
A powerful library for precision arithmetic and number formatting in JavaScript/TypeScript.
Install
npm install a-calcPrecision Arithmetic
import { calc } from "a-calc";
calc("0.1 + 0.2"); // "0.3"
calc("a + b", { a: 1, b: 2 }); // "3"Formatting
calc("1234567 | ,"); // "1,234,567"
calc("1234567 | =2,"); // "1,234,567.00"
calc("1234567 | !c"); // "1.23M"
import { fmt } from "a-calc";
fmt(1234567, "=2,"); // "1,234,567.00"Chain API
import { cadd } from "a-calc";
cadd(100, 200, 300)(); // "600"
cadd(1000, 2000)("=2,"); // "3,000.00"Aggregation
import { calc_sum, calc_avg } from "a-calc";
calc_sum("price", [{ price: 10 }, { price: 20 }]); // "30"
calc_avg("score", [{ score: 80 }, { score: 90 }]); // "85"Standalone Arithmetic
import { add, mul } from "a-calc";
add(0.1, 0.2); // 0.3
mul(3, 4, 5); // 60For the full API reference, visit https://a-calc.vercel.app/.
