@agrozyme/numeric 1.0.21 → 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 CHANGED
@@ -1,8 +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';
8
+ /**
9
+ * - must use `@types/node@16` for Symbol typing
10
+ * - must put `@types/bn.js` in dependencies section of package.json
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
+ * */
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.formatValue = exports.toNumerics = exports.toNumeric = exports.toIntegerString = exports.toBN = exports.toBigNumber = exports.toBigInteger = exports.toBigInt = exports.Zero = exports.WeiPerEther = exports.Two = exports.One = exports.NegativeOne = exports.MinInt256 = exports.MaxUint256 = exports.MaxInt256 = exports.setupNumericConfig = exports.getNumericConfig = exports.Numeric = void 0;
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,16 +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; } });
29
+ /**
30
+ * - must use `@types/node@16` for Symbol typing
31
+ * - must put `@types/bn.js` in dependencies section of package.json
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
+ * */
30
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,wCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAGhB,sCAAgE;AAAvD,0GAAA,gBAAgB,OAAA;AAAE,4GAAA,kBAAkB,OAAA;AAE7C,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;AAEnF,wCAA8G;AAArG,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;AAE1F,sCAAuC;AAA9B,qGAAA,WAAW,OAAA;AAGpB,sCAAsD;AAA7C,oHAAA,0BAA0B,OAAA"}
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,7 +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";
6
+ /**
7
+ * - must use `@types/node@16` for Symbol typing
8
+ * - must put `@types/bn.js` in dependencies section of package.json
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
+ * */
7
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;OAGX,EAAE,gBAAgB,EAAE,kBAAkB,EAAE;OAExC,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE;OAE9E,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE;OAErF,EAAE,WAAW,EAAE;OAGf,EAAE,0BAA0B,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,13 +1,20 @@
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
- declare const inspect: unique symbol;
7
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;
8
16
  export declare class Numeric extends Decimal {
9
17
  constructor(value: NumericValue);
10
- get [Symbol.toStringTag](): string;
11
18
  static abs(value: NumericValue): Numeric;
12
19
  static acos(value: NumericValue): Numeric;
13
20
  static acosh(value: NumericValue): Numeric;
@@ -15,10 +22,11 @@ export declare class Numeric extends Decimal {
15
22
  static asin(value: NumericValue): Numeric;
16
23
  static asinh(value: NumericValue): Numeric;
17
24
  static atan(value: NumericValue): Numeric;
18
- static atan2(x: NumericValue, y: NumericValue): Numeric;
19
25
  static atanh(value: NumericValue): Numeric;
26
+ static atan2(x: NumericValue, y: NumericValue): Numeric;
20
27
  static cbrt(value: NumericValue): Numeric;
21
28
  static ceil(value: NumericValue): Numeric;
29
+ static clamp(value: NumericValue, min: NumericValue, max: NumericValue): Numeric;
22
30
  static cos(value: NumericValue): Numeric;
23
31
  static cosh(value: NumericValue): Numeric;
24
32
  static div(x: NumericValue, y: NumericValue): Numeric;
@@ -27,8 +35,8 @@ export declare class Numeric extends Decimal {
27
35
  static hypot(...values: NumericValue[]): Numeric;
28
36
  static ln(value: NumericValue): Numeric;
29
37
  static log(value: NumericValue, base?: NumericValue): Numeric;
30
- static log10(value: NumericValue): Numeric;
31
38
  static log2(value: NumericValue): Numeric;
39
+ static log10(value: NumericValue): Numeric;
32
40
  static max(...values: NumericValue[]): Numeric;
33
41
  static min(...values: NumericValue[]): Numeric;
34
42
  static mod(x: NumericValue, y: NumericValue): Numeric;
@@ -42,85 +50,86 @@ export declare class Numeric extends Decimal {
42
50
  static sinh(value: NumericValue): Numeric;
43
51
  static sqrt(value: NumericValue): Numeric;
44
52
  static sub(x: NumericValue, y: NumericValue): Numeric;
53
+ static sum(...values: NumericValue[]): Numeric;
45
54
  static tan(value: NumericValue): Numeric;
46
55
  static tanh(value: NumericValue): Numeric;
47
56
  static trunc(value: NumericValue): Numeric;
48
- abs(): Numeric;
49
57
  absoluteValue(): Numeric;
50
- acos(): Numeric;
51
- acosh(): Numeric;
52
- add(value: NumericValue): Numeric;
53
- asin(): Numeric;
54
- asinh(): Numeric;
55
- atan(): Numeric;
56
- atanh(): Numeric;
57
- cbrt(): Numeric;
58
+ abs(): Numeric;
58
59
  ceil(): Numeric;
59
- cmp(value: NumericValue): number;
60
+ clampedTo(min: NumericValue, max: NumericValue): Numeric;
61
+ clamp(min: NumericValue, max: NumericValue): Numeric;
60
62
  comparedTo(value: NumericValue): number;
61
- cos(): Numeric;
62
- cosh(): Numeric;
63
+ cmp(value: NumericValue): number;
63
64
  cosine(): Numeric;
65
+ cos(): Numeric;
64
66
  cubeRoot(): Numeric;
65
- div(value: NumericValue): Numeric;
66
- divToInt(value: NumericValue): Numeric;
67
+ cbrt(): Numeric;
67
68
  dividedBy(value: NumericValue): Numeric;
69
+ div(value: NumericValue): Numeric;
68
70
  dividedToIntegerBy(value: NumericValue): Numeric;
69
- eq(value: NumericValue): boolean;
71
+ divToInt(value: NumericValue): Numeric;
70
72
  equals(value: NumericValue): boolean;
71
- exp(): Numeric;
73
+ eq(value: NumericValue): boolean;
72
74
  floor(): Numeric;
73
75
  greaterThan(value: NumericValue): boolean;
74
- greaterThanOrEqualTo(value: NumericValue): boolean;
75
76
  gt(value: NumericValue): boolean;
77
+ greaterThanOrEqualTo(value: NumericValue): boolean;
76
78
  gte(value: NumericValue): boolean;
77
79
  hyperbolicCosine(): Numeric;
80
+ cosh(): Numeric;
78
81
  hyperbolicSine(): Numeric;
82
+ sinh(): Numeric;
79
83
  hyperbolicTangent(): Numeric;
84
+ tanh(): Numeric;
80
85
  inverseCosine(): Numeric;
86
+ acos(): Numeric;
81
87
  inverseHyperbolicCosine(): Numeric;
88
+ acosh(): Numeric;
82
89
  inverseHyperbolicSine(): Numeric;
90
+ asinh(): Numeric;
83
91
  inverseHyperbolicTangent(): Numeric;
92
+ atanh(): Numeric;
84
93
  inverseSine(): Numeric;
94
+ asin(): Numeric;
85
95
  inverseTangent(): Numeric;
96
+ atan(): Numeric;
86
97
  lessThan(value: NumericValue): boolean;
87
- lessThanOrEqualTo(value: NumericValue): boolean;
88
- ln(): Numeric;
89
- log(value?: NumericValue): Numeric;
90
- logarithm(value?: NumericValue): Numeric;
91
98
  lt(value: NumericValue): boolean;
99
+ lessThanOrEqualTo(value: NumericValue): boolean;
92
100
  lte(value: NumericValue): boolean;
101
+ logarithm(value?: NumericValue): Numeric;
102
+ log(value?: NumericValue): Numeric;
93
103
  minus(value: NumericValue): Numeric;
94
- mod(value: NumericValue): Numeric;
104
+ sub(value: NumericValue): Numeric;
95
105
  modulo(value: NumericValue): Numeric;
96
- mul(value: NumericValue): Numeric;
106
+ mod(value: NumericValue): Numeric;
97
107
  naturalExponential(): Numeric;
108
+ exp(): Numeric;
98
109
  naturalLogarithm(): Numeric;
99
- neg(): Numeric;
110
+ ln(): Numeric;
100
111
  negated(): Numeric;
112
+ neg(): Numeric;
101
113
  plus(value: NumericValue): Numeric;
102
- pow(value: NumericValue): Numeric;
114
+ add(value: NumericValue): Numeric;
103
115
  round(): Numeric;
104
- sin(): Numeric;
105
116
  sine(): Numeric;
106
- sinh(): Numeric;
107
- sqrt(): Numeric;
117
+ sin(): Numeric;
108
118
  squareRoot(): Numeric;
109
- sub(value: NumericValue): Numeric;
110
- tan(): Numeric;
119
+ sqrt(): Numeric;
111
120
  tangent(): Numeric;
112
- tanh(): Numeric;
121
+ tan(): Numeric;
113
122
  times(value: NumericValue): Numeric;
114
- toDP(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
123
+ mul(value: NumericValue): Numeric;
115
124
  toDecimalPlaces(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
125
+ toDP(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
116
126
  toFraction(maxDenominator?: NumericValue): Numeric[];
117
127
  toNearest(value: NumericValue, rounding?: Decimal.Rounding): Numeric;
118
128
  toPower(value: NumericValue): Numeric;
119
- toSD(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
129
+ pow(value: NumericValue): Numeric;
120
130
  toSignificantDigits(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
121
- trunc(): Numeric;
131
+ toSD(decimalPlaces?: number, rounding?: Decimal.Rounding): Numeric;
122
132
  truncated(): Numeric;
133
+ trunc(): Numeric;
123
134
  inspect(depth: number, options: InspectOptionsStylized): string;
124
- [inspect]: (depth: number, options: InspectOptionsStylized) => string;
125
135
  }
126
- export {};