bigmathex 0.0.1-security → 1.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.

Potentially problematic release.


This version of bigmathex might be problematic. Click here for more details.

Files changed (5) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +117 -5
  3. package/big.js +1043 -0
  4. package/big.mjs +1027 -0
  5. package/package.json +47 -6
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 krystalreeves85
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,117 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=bigmathex for more information.
1
+ # bigmathex
2
+
3
+ A lightweight, high-precision **big number** utility for JavaScript and Node.js.
4
+ Designed for financial calculations, blockchain integrations, and any environment where native JavaScript numbers are not enough.
5
+
6
+ ## ✨ Features
7
+
8
+ - 🔢 Arbitrary-precision math using BigInt
9
+ - ⚡ Zero dependencies — fast & secure
10
+ - 🧮 Easy-to-use math functions (`add`, `sub`, `mul`, `div`, `pow`, etc.)
11
+ - 🧱 Type-safe and stable
12
+ - 🔒 Suitable for cryptography, blockchain, finance, token math
13
+ - 📦 Works in Node.js and bundlers (Vite, Webpack, etc.)
14
+
15
+ ## 📦 Installation
16
+
17
+ The library is the single JavaScript file *big.js* or the ES module *big.mjs*.
18
+
19
+ ### [Node.js](http://nodejs.org)
20
+
21
+ ```bash
22
+ $ npm install bigmathex
23
+ ```
24
+
25
+ CommonJS:
26
+
27
+ ```javascript
28
+ const Big = require('bigmathex');
29
+ ```
30
+
31
+ ES module:
32
+
33
+ ```javascript
34
+ import Big from 'bigmathex';
35
+ ```
36
+
37
+ ## 🚀 Usage
38
+
39
+ *In the code examples below, semicolons and `toString` calls are not shown.*
40
+
41
+ The library exports a single constructor function, `Big`.
42
+
43
+ A Big number is created from a primitive number, string, or other Big number.
44
+
45
+ ```javascript
46
+ x = new Big(123.4567)
47
+ y = Big('123456.7e-3') // 'new' is optional
48
+ z = new Big(x)
49
+ x.eq(y) && x.eq(z) && y.eq(z) // true
50
+ ```
51
+
52
+ In Big strict mode, creating a Big number from a primitive number is disallowed.
53
+
54
+ ```javascript
55
+ Big.strict = true
56
+ x = new Big(1) // TypeError: [bigmathex] Invalid number
57
+ y = new Big('1.0000000000000001')
58
+ y.toNumber() // Error: [bigmathex] Imprecise conversion
59
+ ```
60
+
61
+ A Big number is immutable in the sense that it is not changed by its methods.
62
+
63
+ ```javascript
64
+ 0.3 - 0.1 // 0.19999999999999998
65
+ x = new Big(0.3)
66
+ x.minus(0.1) // "0.2"
67
+ x // "0.3"
68
+ ```
69
+
70
+ The methods that return a Big number can be chained.
71
+
72
+ ```javascript
73
+ x.div(y).plus(z).times(9).minus('1.234567801234567e+8').plus(976.54321).div('2598.11772')
74
+ x.sqrt().div(y).pow(3).gt(y.mod(z)) // true
75
+ ```
76
+
77
+ Like JavaScript's Number type, there are `toExponential`, `toFixed` and `toPrecision` methods.
78
+
79
+ ```javascript
80
+ x = new Big(255.5)
81
+ x.toExponential(5) // "2.55500e+2"
82
+ x.toFixed(5) // "255.50000"
83
+ x.toPrecision(5) // "255.50"
84
+ ```
85
+
86
+ The arithmetic methods always return the exact result except `div`, `sqrt` and `pow`
87
+ (with negative exponent), as these methods involve division.
88
+
89
+ The maximum number of decimal places and the rounding mode used to round the results of these methods is determined by the value of the `DP` and `RM` properties of the `Big` number constructor.
90
+
91
+ ```javascript
92
+ Big.DP = 10
93
+ Big.RM = Big.roundHalfUp
94
+
95
+ x = new Big(2);
96
+ y = new Big(3);
97
+ z = x.div(y) // "0.6666666667"
98
+ z.sqrt() // "0.8164965809"
99
+ z.pow(-3) // "3.3749999995"
100
+ z.times(z) // "0.44444444448888888889"
101
+ z.times(z).round(10) // "0.4444444445"
102
+ ```
103
+
104
+ The value of a Big number is stored in a decimal floating point format in terms of a coefficient, exponent and sign.
105
+
106
+ ```javascript
107
+ x = new Big(-123.456);
108
+ x.c // [1,2,3,4,5,6] coefficient (i.e. significand)
109
+ x.e // 2 exponent
110
+ x.s // -1 sign
111
+ ```
112
+
113
+ For advanced usage, multiple Big number constructors can be created, each with an independent configuration.
114
+
115
+ ## 📄 Licence
116
+
117
+ [MIT](LICENCE.md)