@agrozyme/numeric 1.0.22 → 1.0.23
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/lib/index.d.ts +4 -4
- package/lib/index.js +11 -11
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +3 -3
- package/lib/index.mjs.map +1 -1
- package/lib/numeric.d.ts +50 -37
- package/lib/numeric.js +127 -101
- package/lib/numeric.js.map +1 -1
- package/lib/numeric.mjs +115 -96
- package/lib/numeric.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -7
- package/src/numeric.ts +140 -116
- package/lib/convert.d.ts +0 -11
- package/lib/convert.js +0 -23
- package/lib/convert.js.map +0 -1
- package/lib/convert.mjs +0 -12
- package/lib/convert.mjs.map +0 -1
- package/src/convert.ts +0 -12
package/lib/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { Numeric } from './numeric';
|
|
1
|
+
export { Numeric, toBigInt, toBigInteger, toBigNumber, toBN, toIntegerString, toNumeric, toNumerics } from './numeric';
|
|
2
2
|
export type { NumericValue } from './numeric';
|
|
3
|
-
export { getNumericConfig, setupNumericConfig } from './config';
|
|
4
|
-
export { MaxInt256, MaxUint256, MinInt256, NegativeOne, One, Two, WeiPerEther, Zero } from './constants';
|
|
5
|
-
export { toBigInt, toBigInteger, toBigNumber, toBN, toIntegerString, toNumeric, toNumerics } from './convert';
|
|
6
3
|
export { formatValue } from './format';
|
|
7
4
|
export type { IFormatNumberOptions } from './format';
|
|
5
|
+
export { getNumericConfig, setupNumericConfig } from './config';
|
|
6
|
+
export { MaxInt256, MaxUint256, MinInt256, NegativeOne, One, Two, WeiPerEther, Zero } from './constants';
|
|
8
7
|
export { createArrayCompareFunction } from './helper';
|
|
9
8
|
/**
|
|
10
9
|
* - must use `@types/node@16` for Symbol typing
|
|
11
10
|
* - must put `@types/bn.js` in dependencies section of package.json
|
|
12
11
|
* - must set `rootDir` to `src` that in compilerOptions section of tscnfig.json (for bundler tools)
|
|
12
|
+
* - must use `import 'decimal.js'` to import decimal.js namespace (for fix TS)
|
|
13
13
|
* */
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createArrayCompareFunction = exports.
|
|
3
|
+
exports.createArrayCompareFunction = exports.Zero = exports.WeiPerEther = exports.Two = exports.One = exports.NegativeOne = exports.MinInt256 = exports.MaxUint256 = exports.MaxInt256 = exports.setupNumericConfig = exports.getNumericConfig = exports.formatValue = exports.toNumerics = exports.toNumeric = exports.toIntegerString = exports.toBN = exports.toBigNumber = exports.toBigInteger = exports.toBigInt = exports.Numeric = void 0;
|
|
4
4
|
var numeric_1 = require("./numeric.js");
|
|
5
5
|
Object.defineProperty(exports, "Numeric", { enumerable: true, get: function () { return numeric_1.Numeric; } });
|
|
6
|
+
Object.defineProperty(exports, "toBigInt", { enumerable: true, get: function () { return numeric_1.toBigInt; } });
|
|
7
|
+
Object.defineProperty(exports, "toBigInteger", { enumerable: true, get: function () { return numeric_1.toBigInteger; } });
|
|
8
|
+
Object.defineProperty(exports, "toBigNumber", { enumerable: true, get: function () { return numeric_1.toBigNumber; } });
|
|
9
|
+
Object.defineProperty(exports, "toBN", { enumerable: true, get: function () { return numeric_1.toBN; } });
|
|
10
|
+
Object.defineProperty(exports, "toIntegerString", { enumerable: true, get: function () { return numeric_1.toIntegerString; } });
|
|
11
|
+
Object.defineProperty(exports, "toNumeric", { enumerable: true, get: function () { return numeric_1.toNumeric; } });
|
|
12
|
+
Object.defineProperty(exports, "toNumerics", { enumerable: true, get: function () { return numeric_1.toNumerics; } });
|
|
13
|
+
var format_1 = require("./format.js");
|
|
14
|
+
Object.defineProperty(exports, "formatValue", { enumerable: true, get: function () { return format_1.formatValue; } });
|
|
6
15
|
var config_1 = require("./config.js");
|
|
7
16
|
Object.defineProperty(exports, "getNumericConfig", { enumerable: true, get: function () { return config_1.getNumericConfig; } });
|
|
8
17
|
Object.defineProperty(exports, "setupNumericConfig", { enumerable: true, get: function () { return config_1.setupNumericConfig; } });
|
|
@@ -15,21 +24,12 @@ Object.defineProperty(exports, "One", { enumerable: true, get: function () { ret
|
|
|
15
24
|
Object.defineProperty(exports, "Two", { enumerable: true, get: function () { return constants_1.Two; } });
|
|
16
25
|
Object.defineProperty(exports, "WeiPerEther", { enumerable: true, get: function () { return constants_1.WeiPerEther; } });
|
|
17
26
|
Object.defineProperty(exports, "Zero", { enumerable: true, get: function () { return constants_1.Zero; } });
|
|
18
|
-
var convert_1 = require("./convert.js");
|
|
19
|
-
Object.defineProperty(exports, "toBigInt", { enumerable: true, get: function () { return convert_1.toBigInt; } });
|
|
20
|
-
Object.defineProperty(exports, "toBigInteger", { enumerable: true, get: function () { return convert_1.toBigInteger; } });
|
|
21
|
-
Object.defineProperty(exports, "toBigNumber", { enumerable: true, get: function () { return convert_1.toBigNumber; } });
|
|
22
|
-
Object.defineProperty(exports, "toBN", { enumerable: true, get: function () { return convert_1.toBN; } });
|
|
23
|
-
Object.defineProperty(exports, "toIntegerString", { enumerable: true, get: function () { return convert_1.toIntegerString; } });
|
|
24
|
-
Object.defineProperty(exports, "toNumeric", { enumerable: true, get: function () { return convert_1.toNumeric; } });
|
|
25
|
-
Object.defineProperty(exports, "toNumerics", { enumerable: true, get: function () { return convert_1.toNumerics; } });
|
|
26
|
-
var format_1 = require("./format.js");
|
|
27
|
-
Object.defineProperty(exports, "formatValue", { enumerable: true, get: function () { return format_1.formatValue; } });
|
|
28
27
|
var helper_1 = require("./helper.js");
|
|
29
28
|
Object.defineProperty(exports, "createArrayCompareFunction", { enumerable: true, get: function () { return helper_1.createArrayCompareFunction; } });
|
|
30
29
|
/**
|
|
31
30
|
* - must use `@types/node@16` for Symbol typing
|
|
32
31
|
* - must put `@types/bn.js` in dependencies section of package.json
|
|
33
32
|
* - must set `rootDir` to `src` that in compilerOptions section of tscnfig.json (for bundler tools)
|
|
33
|
+
* - must use `import 'decimal.js'` to import decimal.js namespace (for fix TS)
|
|
34
34
|
* */
|
|
35
35
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wCAAuH;AAA9G,kGAAA,OAAO,OAAA;AAAE,mGAAA,QAAQ,OAAA;AAAE,uGAAA,YAAY,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAE,0GAAA,eAAe,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,qGAAA,UAAU,OAAA;AAGnG,sCAAuC;AAA9B,qGAAA,WAAW,OAAA;AAGpB,sCAAgE;AAAvD,0GAAA,gBAAgB,OAAA;AAAE,4GAAA,kBAAkB,OAAA;AAC7C,4CAAyG;AAAhG,sGAAA,SAAS,OAAA;AAAE,uGAAA,UAAU,OAAA;AAAE,sGAAA,SAAS,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,gGAAA,GAAG,OAAA;AAAE,gGAAA,GAAG,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,iGAAA,IAAI,OAAA;AACnF,sCAAsD;AAA7C,oHAAA,0BAA0B,OAAA;AAEnC;;;;;KAKK"}
|
package/lib/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { Numeric } from "./numeric.mjs";
|
|
1
|
+
export { Numeric, toBigInt, toBigInteger, toBigNumber, toBN, toIntegerString, toNumeric, toNumerics } from "./numeric.mjs";
|
|
2
|
+
export { formatValue } from "./format.mjs";
|
|
2
3
|
export { getNumericConfig, setupNumericConfig } from "./config.mjs";
|
|
3
4
|
export { MaxInt256, MaxUint256, MinInt256, NegativeOne, One, Two, WeiPerEther, Zero } from "./constants.mjs";
|
|
4
|
-
export { toBigInt, toBigInteger, toBigNumber, toBN, toIntegerString, toNumeric, toNumerics } from "./convert.mjs";
|
|
5
|
-
export { formatValue } from "./format.mjs";
|
|
6
5
|
export { createArrayCompareFunction } from "./helper.mjs";
|
|
7
6
|
/**
|
|
8
7
|
* - must use `@types/node@16` for Symbol typing
|
|
9
8
|
* - must put `@types/bn.js` in dependencies section of package.json
|
|
10
9
|
* - must set `rootDir` to `src` that in compilerOptions section of tscnfig.json (for bundler tools)
|
|
10
|
+
* - must use `import 'decimal.js'` to import decimal.js namespace (for fix TS)
|
|
11
11
|
* */
|
|
12
12
|
//# sourceMappingURL=index.mjs.map
|
package/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"OAAO,EAAE,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE;OAG9F,EAAE,WAAW,EAAE;OAGf,EAAE,gBAAgB,EAAE,kBAAkB,EAAE;OACxC,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE;OAC9E,EAAE,0BAA0B,EAAE;AAErC;;;;;KAKK"}
|
package/lib/numeric.d.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { BigNumberish } from '@ethersproject/bignumber';
|
|
2
|
+
import { BigNumber, BigNumberish } from '@ethersproject/bignumber';
|
|
3
3
|
import bigInt from 'big-integer';
|
|
4
|
+
import BN from 'bn.js';
|
|
5
|
+
import 'decimal.js';
|
|
4
6
|
import { Decimal } from 'decimal.js';
|
|
5
7
|
import { InspectOptionsStylized } from 'node:util';
|
|
6
8
|
export type NumericValue = Numeric | Decimal.Value | bigInt.BigNumber | BigNumberish;
|
|
9
|
+
export declare const toNumeric: (value: NumericValue) => Numeric;
|
|
10
|
+
export declare const toNumerics: (values: NumericValue[]) => Numeric[];
|
|
11
|
+
export declare const toIntegerString: (value: NumericValue) => string;
|
|
12
|
+
export declare const toBigInt: (value: NumericValue) => bigint;
|
|
13
|
+
export declare const toBN: (value: NumericValue) => BN;
|
|
14
|
+
export declare const toBigInteger: (value: NumericValue) => bigInt.BigInteger;
|
|
15
|
+
export declare const toBigNumber: (value: NumericValue) => BigNumber;
|
|
7
16
|
export declare class Numeric extends Decimal {
|
|
8
17
|
constructor(value: NumericValue);
|
|
9
18
|
static abs(value: NumericValue): Numeric;
|
|
@@ -13,10 +22,11 @@ export declare class Numeric extends Decimal {
|
|
|
13
22
|
static asin(value: NumericValue): Numeric;
|
|
14
23
|
static asinh(value: NumericValue): Numeric;
|
|
15
24
|
static atan(value: NumericValue): Numeric;
|
|
16
|
-
static atan2(x: NumericValue, y: NumericValue): Numeric;
|
|
17
25
|
static atanh(value: NumericValue): Numeric;
|
|
26
|
+
static atan2(x: NumericValue, y: NumericValue): Numeric;
|
|
18
27
|
static cbrt(value: NumericValue): Numeric;
|
|
19
28
|
static ceil(value: NumericValue): Numeric;
|
|
29
|
+
static clamp(value: NumericValue, min: NumericValue, max: NumericValue): Numeric;
|
|
20
30
|
static cos(value: NumericValue): Numeric;
|
|
21
31
|
static cosh(value: NumericValue): Numeric;
|
|
22
32
|
static div(x: NumericValue, y: NumericValue): Numeric;
|
|
@@ -25,8 +35,8 @@ export declare class Numeric extends Decimal {
|
|
|
25
35
|
static hypot(...values: NumericValue[]): Numeric;
|
|
26
36
|
static ln(value: NumericValue): Numeric;
|
|
27
37
|
static log(value: NumericValue, base?: NumericValue): Numeric;
|
|
28
|
-
static log10(value: NumericValue): Numeric;
|
|
29
38
|
static log2(value: NumericValue): Numeric;
|
|
39
|
+
static log10(value: NumericValue): Numeric;
|
|
30
40
|
static max(...values: NumericValue[]): Numeric;
|
|
31
41
|
static min(...values: NumericValue[]): Numeric;
|
|
32
42
|
static mod(x: NumericValue, y: NumericValue): Numeric;
|
|
@@ -40,83 +50,86 @@ export declare class Numeric extends Decimal {
|
|
|
40
50
|
static sinh(value: NumericValue): Numeric;
|
|
41
51
|
static sqrt(value: NumericValue): Numeric;
|
|
42
52
|
static sub(x: NumericValue, y: NumericValue): Numeric;
|
|
53
|
+
static sum(...values: NumericValue[]): Numeric;
|
|
43
54
|
static tan(value: NumericValue): Numeric;
|
|
44
55
|
static tanh(value: NumericValue): Numeric;
|
|
45
56
|
static trunc(value: NumericValue): Numeric;
|
|
46
|
-
abs(): Numeric;
|
|
47
57
|
absoluteValue(): Numeric;
|
|
48
|
-
|
|
49
|
-
acosh(): Numeric;
|
|
50
|
-
add(value: NumericValue): Numeric;
|
|
51
|
-
asin(): Numeric;
|
|
52
|
-
asinh(): Numeric;
|
|
53
|
-
atan(): Numeric;
|
|
54
|
-
atanh(): Numeric;
|
|
55
|
-
cbrt(): Numeric;
|
|
58
|
+
abs(): Numeric;
|
|
56
59
|
ceil(): Numeric;
|
|
57
|
-
|
|
60
|
+
clampedTo(min: NumericValue, max: NumericValue): Numeric;
|
|
61
|
+
clamp(min: NumericValue, max: NumericValue): Numeric;
|
|
58
62
|
comparedTo(value: NumericValue): number;
|
|
59
|
-
|
|
60
|
-
cosh(): Numeric;
|
|
63
|
+
cmp(value: NumericValue): number;
|
|
61
64
|
cosine(): Numeric;
|
|
65
|
+
cos(): Numeric;
|
|
62
66
|
cubeRoot(): Numeric;
|
|
63
|
-
|
|
64
|
-
divToInt(value: NumericValue): Numeric;
|
|
67
|
+
cbrt(): Numeric;
|
|
65
68
|
dividedBy(value: NumericValue): Numeric;
|
|
69
|
+
div(value: NumericValue): Numeric;
|
|
66
70
|
dividedToIntegerBy(value: NumericValue): Numeric;
|
|
67
|
-
|
|
71
|
+
divToInt(value: NumericValue): Numeric;
|
|
68
72
|
equals(value: NumericValue): boolean;
|
|
69
|
-
|
|
73
|
+
eq(value: NumericValue): boolean;
|
|
70
74
|
floor(): Numeric;
|
|
71
75
|
greaterThan(value: NumericValue): boolean;
|
|
72
|
-
greaterThanOrEqualTo(value: NumericValue): boolean;
|
|
73
76
|
gt(value: NumericValue): boolean;
|
|
77
|
+
greaterThanOrEqualTo(value: NumericValue): boolean;
|
|
74
78
|
gte(value: NumericValue): boolean;
|
|
75
79
|
hyperbolicCosine(): Numeric;
|
|
80
|
+
cosh(): Numeric;
|
|
76
81
|
hyperbolicSine(): Numeric;
|
|
82
|
+
sinh(): Numeric;
|
|
77
83
|
hyperbolicTangent(): Numeric;
|
|
84
|
+
tanh(): Numeric;
|
|
78
85
|
inverseCosine(): Numeric;
|
|
86
|
+
acos(): Numeric;
|
|
79
87
|
inverseHyperbolicCosine(): Numeric;
|
|
88
|
+
acosh(): Numeric;
|
|
80
89
|
inverseHyperbolicSine(): Numeric;
|
|
90
|
+
asinh(): Numeric;
|
|
81
91
|
inverseHyperbolicTangent(): Numeric;
|
|
92
|
+
atanh(): Numeric;
|
|
82
93
|
inverseSine(): Numeric;
|
|
94
|
+
asin(): Numeric;
|
|
83
95
|
inverseTangent(): Numeric;
|
|
96
|
+
atan(): Numeric;
|
|
84
97
|
lessThan(value: NumericValue): boolean;
|
|
85
|
-
lessThanOrEqualTo(value: NumericValue): boolean;
|
|
86
|
-
ln(): Numeric;
|
|
87
|
-
log(value?: NumericValue): Numeric;
|
|
88
|
-
logarithm(value?: NumericValue): Numeric;
|
|
89
98
|
lt(value: NumericValue): boolean;
|
|
99
|
+
lessThanOrEqualTo(value: NumericValue): boolean;
|
|
90
100
|
lte(value: NumericValue): boolean;
|
|
101
|
+
logarithm(value?: NumericValue): Numeric;
|
|
102
|
+
log(value?: NumericValue): Numeric;
|
|
91
103
|
minus(value: NumericValue): Numeric;
|
|
92
|
-
|
|
104
|
+
sub(value: NumericValue): Numeric;
|
|
93
105
|
modulo(value: NumericValue): Numeric;
|
|
94
|
-
|
|
106
|
+
mod(value: NumericValue): Numeric;
|
|
95
107
|
naturalExponential(): Numeric;
|
|
108
|
+
exp(): Numeric;
|
|
96
109
|
naturalLogarithm(): Numeric;
|
|
97
|
-
|
|
110
|
+
ln(): Numeric;
|
|
98
111
|
negated(): Numeric;
|
|
112
|
+
neg(): Numeric;
|
|
99
113
|
plus(value: NumericValue): Numeric;
|
|
100
|
-
|
|
114
|
+
add(value: NumericValue): Numeric;
|
|
101
115
|
round(): Numeric;
|
|
102
|
-
sin(): Numeric;
|
|
103
116
|
sine(): Numeric;
|
|
104
|
-
|
|
105
|
-
sqrt(): Numeric;
|
|
117
|
+
sin(): Numeric;
|
|
106
118
|
squareRoot(): Numeric;
|
|
107
|
-
|
|
108
|
-
tan(): Numeric;
|
|
119
|
+
sqrt(): Numeric;
|
|
109
120
|
tangent(): Numeric;
|
|
110
|
-
|
|
121
|
+
tan(): Numeric;
|
|
111
122
|
times(value: NumericValue): Numeric;
|
|
112
|
-
|
|
123
|
+
mul(value: NumericValue): Numeric;
|
|
113
124
|
toDecimalPlaces(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
|
|
125
|
+
toDP(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
|
|
114
126
|
toFraction(maxDenominator?: NumericValue): Numeric[];
|
|
115
127
|
toNearest(value: NumericValue, rounding?: Decimal.Rounding): Numeric;
|
|
116
128
|
toPower(value: NumericValue): Numeric;
|
|
117
|
-
|
|
129
|
+
pow(value: NumericValue): Numeric;
|
|
118
130
|
toSignificantDigits(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
|
|
119
|
-
|
|
131
|
+
toSD(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
|
|
120
132
|
truncated(): Numeric;
|
|
133
|
+
trunc(): Numeric;
|
|
121
134
|
inspect(depth: number, options: InspectOptionsStylized): string;
|
|
122
135
|
}
|