@agrozyme/numeric 1.0.22 → 1.0.24
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 +53 -38
- package/lib/numeric.js +129 -101
- package/lib/numeric.js.map +1 -1
- package/lib/numeric.mjs +117 -96
- package/lib/numeric.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -7
- package/src/numeric.ts +143 -117
- 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 import namespaces: `big-integer`, `bn.js`, `decimal.js`
|
|
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 import namespaces: `big-integer`, `bn.js`, `decimal.js`
|
|
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 import namespaces: `big-integer`, `bn.js`, `decimal.js`
|
|
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,20 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { BigNumberish } from '@ethersproject/bignumber';
|
|
2
|
+
import { BigNumber, BigNumberish } from '@ethersproject/bignumber';
|
|
3
|
+
import 'big-integer';
|
|
3
4
|
import bigInt from 'big-integer';
|
|
5
|
+
import 'bn.js';
|
|
6
|
+
import BN from 'bn.js';
|
|
7
|
+
import 'decimal.js';
|
|
4
8
|
import { Decimal } from 'decimal.js';
|
|
5
|
-
import { InspectOptionsStylized } from '
|
|
9
|
+
import { InspectOptionsStylized } from 'util';
|
|
6
10
|
export type NumericValue = Numeric | Decimal.Value | bigInt.BigNumber | BigNumberish;
|
|
11
|
+
export declare const toNumeric: (value: NumericValue) => Numeric;
|
|
12
|
+
export declare const toNumerics: (values: NumericValue[]) => Numeric[];
|
|
13
|
+
export declare const toIntegerString: (value: NumericValue) => string;
|
|
14
|
+
export declare const toBigInt: (value: NumericValue) => bigint;
|
|
15
|
+
export declare const toBN: (value: NumericValue) => BN;
|
|
16
|
+
export declare const toBigInteger: (value: NumericValue) => bigInt.BigInteger;
|
|
17
|
+
export declare const toBigNumber: (value: NumericValue) => BigNumber;
|
|
7
18
|
export declare class Numeric extends Decimal {
|
|
8
19
|
constructor(value: NumericValue);
|
|
9
20
|
static abs(value: NumericValue): Numeric;
|
|
@@ -13,10 +24,11 @@ export declare class Numeric extends Decimal {
|
|
|
13
24
|
static asin(value: NumericValue): Numeric;
|
|
14
25
|
static asinh(value: NumericValue): Numeric;
|
|
15
26
|
static atan(value: NumericValue): Numeric;
|
|
16
|
-
static atan2(x: NumericValue, y: NumericValue): Numeric;
|
|
17
27
|
static atanh(value: NumericValue): Numeric;
|
|
28
|
+
static atan2(x: NumericValue, y: NumericValue): Numeric;
|
|
18
29
|
static cbrt(value: NumericValue): Numeric;
|
|
19
30
|
static ceil(value: NumericValue): Numeric;
|
|
31
|
+
static clamp(value: NumericValue, min: NumericValue, max: NumericValue): Numeric;
|
|
20
32
|
static cos(value: NumericValue): Numeric;
|
|
21
33
|
static cosh(value: NumericValue): Numeric;
|
|
22
34
|
static div(x: NumericValue, y: NumericValue): Numeric;
|
|
@@ -25,8 +37,8 @@ export declare class Numeric extends Decimal {
|
|
|
25
37
|
static hypot(...values: NumericValue[]): Numeric;
|
|
26
38
|
static ln(value: NumericValue): Numeric;
|
|
27
39
|
static log(value: NumericValue, base?: NumericValue): Numeric;
|
|
28
|
-
static log10(value: NumericValue): Numeric;
|
|
29
40
|
static log2(value: NumericValue): Numeric;
|
|
41
|
+
static log10(value: NumericValue): Numeric;
|
|
30
42
|
static max(...values: NumericValue[]): Numeric;
|
|
31
43
|
static min(...values: NumericValue[]): Numeric;
|
|
32
44
|
static mod(x: NumericValue, y: NumericValue): Numeric;
|
|
@@ -40,83 +52,86 @@ export declare class Numeric extends Decimal {
|
|
|
40
52
|
static sinh(value: NumericValue): Numeric;
|
|
41
53
|
static sqrt(value: NumericValue): Numeric;
|
|
42
54
|
static sub(x: NumericValue, y: NumericValue): Numeric;
|
|
55
|
+
static sum(...values: NumericValue[]): Numeric;
|
|
43
56
|
static tan(value: NumericValue): Numeric;
|
|
44
57
|
static tanh(value: NumericValue): Numeric;
|
|
45
58
|
static trunc(value: NumericValue): Numeric;
|
|
46
|
-
abs(): Numeric;
|
|
47
59
|
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;
|
|
60
|
+
abs(): Numeric;
|
|
56
61
|
ceil(): Numeric;
|
|
57
|
-
|
|
62
|
+
clampedTo(min: NumericValue, max: NumericValue): Numeric;
|
|
63
|
+
clamp(min: NumericValue, max: NumericValue): Numeric;
|
|
58
64
|
comparedTo(value: NumericValue): number;
|
|
59
|
-
|
|
60
|
-
cosh(): Numeric;
|
|
65
|
+
cmp(value: NumericValue): number;
|
|
61
66
|
cosine(): Numeric;
|
|
67
|
+
cos(): Numeric;
|
|
62
68
|
cubeRoot(): Numeric;
|
|
63
|
-
|
|
64
|
-
divToInt(value: NumericValue): Numeric;
|
|
69
|
+
cbrt(): Numeric;
|
|
65
70
|
dividedBy(value: NumericValue): Numeric;
|
|
71
|
+
div(value: NumericValue): Numeric;
|
|
66
72
|
dividedToIntegerBy(value: NumericValue): Numeric;
|
|
67
|
-
|
|
73
|
+
divToInt(value: NumericValue): Numeric;
|
|
68
74
|
equals(value: NumericValue): boolean;
|
|
69
|
-
|
|
75
|
+
eq(value: NumericValue): boolean;
|
|
70
76
|
floor(): Numeric;
|
|
71
77
|
greaterThan(value: NumericValue): boolean;
|
|
72
|
-
greaterThanOrEqualTo(value: NumericValue): boolean;
|
|
73
78
|
gt(value: NumericValue): boolean;
|
|
79
|
+
greaterThanOrEqualTo(value: NumericValue): boolean;
|
|
74
80
|
gte(value: NumericValue): boolean;
|
|
75
81
|
hyperbolicCosine(): Numeric;
|
|
82
|
+
cosh(): Numeric;
|
|
76
83
|
hyperbolicSine(): Numeric;
|
|
84
|
+
sinh(): Numeric;
|
|
77
85
|
hyperbolicTangent(): Numeric;
|
|
86
|
+
tanh(): Numeric;
|
|
78
87
|
inverseCosine(): Numeric;
|
|
88
|
+
acos(): Numeric;
|
|
79
89
|
inverseHyperbolicCosine(): Numeric;
|
|
90
|
+
acosh(): Numeric;
|
|
80
91
|
inverseHyperbolicSine(): Numeric;
|
|
92
|
+
asinh(): Numeric;
|
|
81
93
|
inverseHyperbolicTangent(): Numeric;
|
|
94
|
+
atanh(): Numeric;
|
|
82
95
|
inverseSine(): Numeric;
|
|
96
|
+
asin(): Numeric;
|
|
83
97
|
inverseTangent(): Numeric;
|
|
98
|
+
atan(): Numeric;
|
|
84
99
|
lessThan(value: NumericValue): boolean;
|
|
85
|
-
lessThanOrEqualTo(value: NumericValue): boolean;
|
|
86
|
-
ln(): Numeric;
|
|
87
|
-
log(value?: NumericValue): Numeric;
|
|
88
|
-
logarithm(value?: NumericValue): Numeric;
|
|
89
100
|
lt(value: NumericValue): boolean;
|
|
101
|
+
lessThanOrEqualTo(value: NumericValue): boolean;
|
|
90
102
|
lte(value: NumericValue): boolean;
|
|
103
|
+
logarithm(value?: NumericValue): Numeric;
|
|
104
|
+
log(value?: NumericValue): Numeric;
|
|
91
105
|
minus(value: NumericValue): Numeric;
|
|
92
|
-
|
|
106
|
+
sub(value: NumericValue): Numeric;
|
|
93
107
|
modulo(value: NumericValue): Numeric;
|
|
94
|
-
|
|
108
|
+
mod(value: NumericValue): Numeric;
|
|
95
109
|
naturalExponential(): Numeric;
|
|
110
|
+
exp(): Numeric;
|
|
96
111
|
naturalLogarithm(): Numeric;
|
|
97
|
-
|
|
112
|
+
ln(): Numeric;
|
|
98
113
|
negated(): Numeric;
|
|
114
|
+
neg(): Numeric;
|
|
99
115
|
plus(value: NumericValue): Numeric;
|
|
100
|
-
|
|
116
|
+
add(value: NumericValue): Numeric;
|
|
101
117
|
round(): Numeric;
|
|
102
|
-
sin(): Numeric;
|
|
103
118
|
sine(): Numeric;
|
|
104
|
-
|
|
105
|
-
sqrt(): Numeric;
|
|
119
|
+
sin(): Numeric;
|
|
106
120
|
squareRoot(): Numeric;
|
|
107
|
-
|
|
108
|
-
tan(): Numeric;
|
|
121
|
+
sqrt(): Numeric;
|
|
109
122
|
tangent(): Numeric;
|
|
110
|
-
|
|
123
|
+
tan(): Numeric;
|
|
111
124
|
times(value: NumericValue): Numeric;
|
|
112
|
-
|
|
125
|
+
mul(value: NumericValue): Numeric;
|
|
113
126
|
toDecimalPlaces(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
|
|
127
|
+
toDP(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
|
|
114
128
|
toFraction(maxDenominator?: NumericValue): Numeric[];
|
|
115
129
|
toNearest(value: NumericValue, rounding?: Decimal.Rounding): Numeric;
|
|
116
130
|
toPower(value: NumericValue): Numeric;
|
|
117
|
-
|
|
131
|
+
pow(value: NumericValue): Numeric;
|
|
118
132
|
toSignificantDigits(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
|
|
119
|
-
|
|
133
|
+
toSD(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
|
|
120
134
|
truncated(): Numeric;
|
|
135
|
+
trunc(): Numeric;
|
|
121
136
|
inspect(depth: number, options: InspectOptionsStylized): string;
|
|
122
137
|
}
|