bignumber-math 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 +70 -0
- package/package.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# expr-eval
|
|
2
|
+
|
|
3
|
+
> This package is no longer maintained. Please use [a-calc](https://www.npmjs.com/package/a-calc) instead — a modern and actively maintained alternative for math expression evaluation and precision arithmetic.
|
|
4
|
+
|
|
5
|
+
## Migration
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install a-calc
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## a-calc Basic Usage
|
|
14
|
+
|
|
15
|
+
A powerful library for precision arithmetic and number formatting in JavaScript/TypeScript.
|
|
16
|
+
|
|
17
|
+
### Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install a-calc
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Precision Arithmetic
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import { calc } from "a-calc";
|
|
27
|
+
|
|
28
|
+
calc("0.1 + 0.2"); // "0.3"
|
|
29
|
+
calc("a + b", { a: 1, b: 2 }); // "3"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Formatting
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
calc("1234567 | ,"); // "1,234,567"
|
|
36
|
+
calc("1234567 | =2,"); // "1,234,567.00"
|
|
37
|
+
calc("1234567 | !c"); // "1.23M"
|
|
38
|
+
|
|
39
|
+
import { fmt } from "a-calc";
|
|
40
|
+
fmt(1234567, "=2,"); // "1,234,567.00"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Chain API
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
import { cadd } from "a-calc";
|
|
47
|
+
|
|
48
|
+
cadd(100, 200, 300)(); // "600"
|
|
49
|
+
cadd(1000, 2000)("=2,"); // "3,000.00"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Aggregation
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
import { calc_sum, calc_avg } from "a-calc";
|
|
56
|
+
|
|
57
|
+
calc_sum("price", [{ price: 10 }, { price: 20 }]); // "30"
|
|
58
|
+
calc_avg("score", [{ score: 80 }, { score: 90 }]); // "85"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Standalone Arithmetic
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
import { add, mul } from "a-calc";
|
|
65
|
+
|
|
66
|
+
add(0.1, 0.2); // 0.3
|
|
67
|
+
mul(3, 4, 5); // 60
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
For the full API reference, visit [https://a-calc.vercel.app/](https://a-calc.vercel.app/).
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bignumber-math",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [
|
|
9
|
+
"bignumber",
|
|
10
|
+
"bignumber.js",
|
|
11
|
+
"big-number",
|
|
12
|
+
"arbitrary precision",
|
|
13
|
+
"precision",
|
|
14
|
+
"bigint",
|
|
15
|
+
"bigdecimal",
|
|
16
|
+
"number",
|
|
17
|
+
"math",
|
|
18
|
+
"arithmetic",
|
|
19
|
+
"decimal",
|
|
20
|
+
"float"
|
|
21
|
+
],
|
|
22
|
+
"author": "",
|
|
23
|
+
"license": "ISC",
|
|
24
|
+
"description": "bignumber.js alternative — redirects to a-calc, a modern precision arithmetic library"
|
|
25
|
+
}
|