big.esm 1.3.0 → 1.3.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/CHANGELOG.md +7 -0
- package/README.md +21 -5
- package/package.json +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.3.1](https://github.com/dschewchenko/big.esm/compare/v1.3.0...v1.3.1) (2023-06-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* docs update ([cac1876](https://github.com/dschewchenko/big.esm/commit/cac1876a8455ff044dc9bab66524e4bba2359cf1))
|
|
7
|
+
|
|
1
8
|
# [1.3.0](https://github.com/dschewchenko/big.esm/compare/v1.2.2...v1.3.0) (2023-06-24)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ It provides advanced functionality for performing arithmetic operations with pre
|
|
|
13
13
|
- Fully written in TypeScript, so it provides type definitions out of the box.
|
|
14
14
|
- Tree-shaking is supported.
|
|
15
15
|
|
|
16
|
-
Full bundle size(ESM) — 4.
|
|
17
|
-
`sqrtBig` operation is heavy(more than half of bundle), because it reuses most of the operations from `big.esm`.
|
|
16
|
+
Full bundle size (ESM) — 4.2 kB minified and 1.8 kB gzipped.
|
|
17
|
+
`sqrtBig` operation is heavy (more than half of bundle), because it reuses most of the operations from `big.esm`.
|
|
18
18
|
|
|
19
19
|
## Installation
|
|
20
20
|
|
|
@@ -24,6 +24,12 @@ Install `big.esm` using npm:
|
|
|
24
24
|
npm install big.esm
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
or yarn:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
yarn add big.esm
|
|
31
|
+
```
|
|
32
|
+
|
|
27
33
|
## Usage
|
|
28
34
|
|
|
29
35
|
```js
|
|
@@ -37,12 +43,12 @@ console.log(result.toString()); // 22222222121.1111111101
|
|
|
37
43
|
|
|
38
44
|
## Compatibility
|
|
39
45
|
|
|
40
|
-
`big.esm` is compatible with all modern browsers and Node.js 10+. It uses `BigInt` internally, so it is not compatible with older browsers and Node.js versions. On info from [caniuse.com](https://caniuse.com/#feat=bigint) `BigInt` is supported by
|
|
46
|
+
`big.esm` is compatible with all modern browsers and Node.js 10+. It uses `BigInt` internally, so it is not compatible with older browsers and Node.js versions. On info from [caniuse.com](https://caniuse.com/#feat=bigint) `BigInt` is supported by 96.47% of all browsers(as of 2023-06-25).
|
|
41
47
|
|
|
42
48
|
## Notes
|
|
43
49
|
|
|
44
50
|
- `big.esm` is not a drop-in replacement for `big.js`. It does not support the same API and does not have the same functionality. It is a completely different library.
|
|
45
|
-
- `
|
|
51
|
+
- `sqrtBig()` is heavy and slow operation. It's implemented using the Newton's method with nth root calculation. In most cases, there will be no problems.
|
|
46
52
|
|
|
47
53
|
## API
|
|
48
54
|
|
|
@@ -76,6 +82,8 @@ Checks if the value is a valid numeric value for creating a `Big` instance.
|
|
|
76
82
|
|
|
77
83
|
In math operations `mutable` option is used to specify whether to mutate the first argument or create a new instance. By default, a new instance is created.
|
|
78
84
|
|
|
85
|
+
**Note:** In high-load applications, it is recommended to use the `mutable` option to reduce memory usage and improve performance.
|
|
86
|
+
|
|
79
87
|
#### `addBig(a: Big, b: Big, mutable = false): Big`
|
|
80
88
|
|
|
81
89
|
Adds two `Big` instances.
|
|
@@ -112,9 +120,17 @@ Returns the absolute value of `a`.
|
|
|
112
120
|
|
|
113
121
|
Compares two `Big` instances. Returns `-1` if `a < b`, `0` if `a == b` and `1` if `a > b`.
|
|
114
122
|
|
|
123
|
+
#### `minBig(a: Big, b: Big, mutable = false): Big`
|
|
124
|
+
|
|
125
|
+
Returns the minimum of two `Big` instances. If the numbers are equal, returns the first number.
|
|
126
|
+
|
|
127
|
+
#### `maxBig(a: Big, b: Big, mutable = false): Big`
|
|
128
|
+
|
|
129
|
+
Returns the maximum of two `Big` instances. If the numbers are equal, returns the first number.
|
|
130
|
+
|
|
115
131
|
## Benchmark
|
|
116
132
|
|
|
117
|
-
Benchmark results are available [here](https://
|
|
133
|
+
Benchmark results are available [here](https://github.com/dschewchenko/big.esm/blob/master/BENCHMARK.md).
|
|
118
134
|
|
|
119
135
|
## Roadmap
|
|
120
136
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "big.esm",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "A small, fast JavaScript library for arbitrary-precision decimal arithmetic.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"node": ">=16"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@commitlint/cli": "^17.6.
|
|
54
|
-
"@commitlint/config-conventional": "^17.6.
|
|
53
|
+
"@commitlint/cli": "^17.6.6",
|
|
54
|
+
"@commitlint/config-conventional": "^17.6.6",
|
|
55
55
|
"@semantic-release/changelog": "^6.0.3",
|
|
56
56
|
"@semantic-release/git": "^10.0.1",
|
|
57
57
|
"@types/jest": "^29.5.1",
|
|
@@ -68,12 +68,14 @@
|
|
|
68
68
|
"is-ci": "^3.0.1",
|
|
69
69
|
"prettier": "^2.8.8",
|
|
70
70
|
"rollup-plugin-visualizer": "^5.9.0",
|
|
71
|
-
"semantic-release": "^21.0.
|
|
71
|
+
"semantic-release": "^21.0.5",
|
|
72
72
|
"ts-jest": "^29.1.0",
|
|
73
|
-
"typedoc": "^0.24.
|
|
73
|
+
"typedoc": "^0.24.8",
|
|
74
74
|
"typedoc-plugin-mdn-links": "^3.0.3",
|
|
75
|
+
"typedoc-plugin-merge-modules": "^5.0.1",
|
|
76
|
+
"typedoc-plugin-pages": "^1.1.0",
|
|
75
77
|
"typescript": "^5.0.4",
|
|
76
|
-
"vite": "^4.3.
|
|
78
|
+
"vite": "^4.3.9",
|
|
77
79
|
"vite-plugin-dts": "^2.3.0",
|
|
78
80
|
"vitest": "^0.31.0"
|
|
79
81
|
}
|