expr-eval-next 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/package.json +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# eval-expr
|
|
2
|
+
|
|
3
|
+
> Looking for **expr-eval**? That package is no longer maintained. This package redirects you to [a-calc](https://www.npmjs.com/package/a-calc), a modern and actively maintained alternative for math expression evaluation and precision arithmetic.
|
|
4
|
+
|
|
5
|
+
This package has been deprecated. Please use [a-calc](https://www.npmjs.com/package/a-calc) instead.
|
|
6
|
+
|
|
7
|
+
## Migration
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm uninstall eval-expr
|
|
11
|
+
npm install a-calc
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## a-calc Basic Usage
|
|
17
|
+
|
|
18
|
+
A powerful library for precision arithmetic and number formatting in JavaScript/TypeScript.
|
|
19
|
+
|
|
20
|
+
### Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install a-calc
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Precision Arithmetic
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import { calc } from "a-calc";
|
|
30
|
+
|
|
31
|
+
calc("0.1 + 0.2"); // "0.3"
|
|
32
|
+
calc("a + b", { a: 1, b: 2 }); // "3"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Formatting
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
calc("1234567 | ,"); // "1,234,567"
|
|
39
|
+
calc("1234567 | =2,"); // "1,234,567.00"
|
|
40
|
+
calc("1234567 | !c"); // "1.23M"
|
|
41
|
+
|
|
42
|
+
import { fmt } from "a-calc";
|
|
43
|
+
fmt(1234567, "=2,"); // "1,234,567.00"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Chain API
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
import { cadd } from "a-calc";
|
|
50
|
+
|
|
51
|
+
cadd(100, 200, 300)(); // "600"
|
|
52
|
+
cadd(1000, 2000)("=2,"); // "3,000.00"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Aggregation
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
import { calc_sum, calc_avg } from "a-calc";
|
|
59
|
+
|
|
60
|
+
calc_sum("price", [{ price: 10 }, { price: 20 }]); // "30"
|
|
61
|
+
calc_avg("score", [{ score: 80 }, { score: 90 }]); // "85"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Standalone Arithmetic
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import { add, mul } from "a-calc";
|
|
68
|
+
|
|
69
|
+
add(0.1, 0.2); // 0.3
|
|
70
|
+
mul(3, 4, 5); // 60
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
For the full API reference, visit [https://a-calc.vercel.app/](https://a-calc.vercel.app/).
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "expr-eval-next",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [
|
|
9
|
+
"expr-eval",
|
|
10
|
+
"expression",
|
|
11
|
+
"eval",
|
|
12
|
+
"math",
|
|
13
|
+
"calculator",
|
|
14
|
+
"arithmetic",
|
|
15
|
+
"formula",
|
|
16
|
+
"parser",
|
|
17
|
+
"precision",
|
|
18
|
+
"float",
|
|
19
|
+
"decimal"
|
|
20
|
+
],
|
|
21
|
+
"author": "",
|
|
22
|
+
"license": "ISC",
|
|
23
|
+
"description": "expr-eval alternative — redirects to a-calc, a modern precision math expression evaluator"
|
|
24
|
+
}
|