@agrozyme/numeric 1.0.29 → 1.0.30

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/package.json CHANGED
@@ -1,64 +1,49 @@
1
1
  {
2
2
  "name": "@agrozyme/numeric",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "description": "",
5
- "main": "./lib/index.js",
6
- "module": "./lib/index.mjs",
7
- "types": "./lib/index.d.ts",
8
5
  "exports": {
9
6
  ".": {
10
- "require": {
11
- "types": "./lib/index.d.ts",
12
- "default": "./lib/index.js"
13
- },
14
- "import": {
15
- "types": "./lib/index.d.ts",
16
- "default": "./lib/index.mjs"
17
- }
7
+ "types": "./out/index.d.ts",
8
+ "require": "./out/index.js",
9
+ "import": "./out/index.mjs"
18
10
  }
19
11
  },
12
+ "main": "./out/index.js",
13
+ "module": "./out/index.mjs",
14
+ "types": "./out/index.d.ts",
20
15
  "repository": {
21
16
  "type": "git",
22
- "url": "git+ssh://git@gitlab.com/agrozyme-package/JavaScript/numeric.git"
17
+ "url": "git+ssh://git@gitlab.com:agrozyme-package/TypeScript/numeric.git"
23
18
  },
24
19
  "keywords": [],
25
20
  "author": "",
26
21
  "license": "ISC",
27
22
  "bugs": {
28
- "url": "https://gitlab.com/agrozyme-package/JavaScript/numeric/issues"
23
+ "url": "https://gitlab.com/agrozyme-package/TypeScript/numeric/issues"
29
24
  },
30
- "homepage": "https://gitlab.com/agrozyme-package/JavaScript/numeric#readme",
25
+ "homepage": "https://gitlab.com/agrozyme-package/TypeScript/numeric#readme",
31
26
  "devDependencies": {
32
- "@types/jasmine": "^5.1.4",
33
- "@types/node": "^16.18.97",
34
- "jasmine": "^5.1.0",
35
- "shx": "^0.3.4",
36
- "ts-node": "^10.9.2",
37
- "tsc-multi": "^1.1.0",
38
- "typescript": "^5.4.5",
27
+ "@rslib/core": "^0.19.1",
28
+ "@types/node": "^22.19.3",
29
+ "shx": "^0.4.0",
30
+ "typescript": "^5.9.3",
39
31
  "yarpm": "^1.2.0"
40
32
  },
41
33
  "dependencies": {
42
- "@ethersproject/bignumber": "^5.7.0",
43
- "@ethersproject/bytes": "^5.7.0",
44
- "@ethersproject/constants": "^5.7.0",
45
- "@types/bn.js": "^5.1.5",
34
+ "@ethersproject/bignumber": "^5.8.0",
35
+ "@ethersproject/bytes": "^5.8.0",
36
+ "@ethersproject/constants": "^5.8.0",
37
+ "@types/bn.js": "^5.2.0",
46
38
  "big-integer": "^1.6.52",
47
- "bn.js": "^5.2.1",
39
+ "bn.js": "^5.2.2",
48
40
  "browser-or-node": "^3.0.0",
49
- "decimal.js": "^10.4.3",
41
+ "decimal.js": "^10.6.0",
50
42
  "format-number": "^3.0.0",
51
- "tslib": "^2.6.2"
43
+ "tslib": "^2.8.1"
52
44
  },
53
45
  "scripts": {
54
- "clean:out": "shx rm -rf out lib",
55
- "clean:tsbuildinfo": "shx rm -f *.tsbuildinfo out/*.tsbuildinfo",
56
- "clean": "yarpm run clean:out && yarpm run clean:tsbuildinfo",
57
- "build:esm": "tsc --module esnext --moduleResolution bundler --outDir out/esm && yarpm run clean:tsbuildinfo",
58
- "build:cjs": "tsc --module commonjs --moduleResolution node --outDir out/cjs && yarpm run clean:tsbuildinfo",
59
- "build:split": "yarpm run clean && yarpm run build:cjs && yarpm run build:esm",
60
- "build:multi": "tsc-multi --clean && tsc-multi --force && yarpm run clean:tsbuildinfo",
61
- "build": "yarpm run clean:out && yarpm run build:multi",
62
- "test": "jasmine --config=jasmine.json"
46
+ "clean": "shx rm -rf dist",
47
+ "build": "rslib build"
63
48
  }
64
49
  }
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from '@rslib/core';
2
+
3
+ export default defineConfig({
4
+ lib: [
5
+ { format: 'esm', syntax: 'esnext', dts: true },
6
+ { format: 'cjs', syntax: 'esnext' },
7
+ ],
8
+ });
package/tsconfig.json CHANGED
@@ -6,14 +6,14 @@
6
6
 
7
7
  // Modules
8
8
  "module": "ESNext",
9
- "moduleResolution": "Node",
10
- "rootDir": "root",
9
+ "moduleResolution": "bundler",
10
+ "rootDir": "src",
11
11
 
12
12
  // Emit
13
13
  "downlevelIteration": true,
14
14
  "importHelpers": true,
15
15
  "newLine": "LF",
16
- "outDir": "out",
16
+ "outDir": "dist",
17
17
  "sourceMap": true,
18
18
 
19
19
  // Interop Constraints
@@ -26,10 +26,11 @@
26
26
 
27
27
  // Projects
28
28
  "composite": true,
29
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildinfo",
29
30
 
30
31
  // Completeness
31
32
  "skipLibCheck": true
32
33
  },
33
- "include": [
34
- "root/**/*.ts", "test/**/*.ts"]
34
+
35
+ "include": ["src/**/*.ts", "test/**/*.ts"]
35
36
  }
package/jasmine.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "spec_dir": "test",
3
- "spec_files": ["**/*.test.ts"],
4
- "requires": ["node_modules/ts-node/register/index.js"],
5
- "stopSpecOnExpectationFailure": false,
6
- "random": true
7
- }
package/lib/config.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { Decimal } from 'decimal.js';
2
- export declare const getNumericConfig: () => Required<Decimal.Config>;
3
- export declare const setupNumericConfig: () => void;
package/lib/config.js DELETED
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setupNumericConfig = exports.getNumericConfig = void 0;
4
- const numeric_1 = require("./numeric.js");
5
- const getNumericConfig = () => {
6
- const { precision, rounding, minE, maxE, toExpNeg, toExpPos, crypto, modulo } = numeric_1.Numeric;
7
- const data = {
8
- precision,
9
- rounding,
10
- minE,
11
- maxE,
12
- toExpNeg,
13
- toExpPos,
14
- crypto,
15
- modulo,
16
- defaults: false,
17
- };
18
- return data;
19
- };
20
- exports.getNumericConfig = getNumericConfig;
21
- const setupNumericConfig = () => {
22
- const config = {
23
- precision: 256,
24
- //rounding: Numeric.ROUND_FLOOR,
25
- toExpNeg: numeric_1.Numeric.minE,
26
- toExpPos: numeric_1.Numeric.maxE,
27
- crypto: false,
28
- };
29
- numeric_1.Numeric.set({ defaults: true });
30
- numeric_1.Numeric.set(config);
31
- };
32
- exports.setupNumericConfig = setupNumericConfig;
33
- //# sourceMappingURL=config.js.map
package/lib/config.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../root/config.ts"],"names":[],"mappings":";;;AACA,0CAAoC;AAE7B,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAO,CAAC;IACxF,MAAM,IAAI,GAA6B;QACrC,SAAS;QACT,QAAQ;QACR,IAAI;QACJ,IAAI;QACJ,QAAQ;QACR,QAAQ;QACR,MAAM;QACN,MAAM;QACN,QAAQ,EAAE,KAAK;KAChB,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAfW,QAAA,gBAAgB,oBAe3B;AAEK,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,MAAM,GAAmB;QAC7B,SAAS,EAAE,GAAG;QACd,gCAAgC;QAChC,QAAQ,EAAE,iBAAO,CAAC,IAAI;QACtB,QAAQ,EAAE,iBAAO,CAAC,IAAI;QACtB,MAAM,EAAE,KAAK;KACd,CAAC;IAEF,iBAAO,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAChC,iBAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC,CAAC;AAXW,QAAA,kBAAkB,sBAW7B"}
package/lib/config.mjs DELETED
@@ -1,28 +0,0 @@
1
- import { Numeric } from "./numeric.mjs";
2
- export const getNumericConfig = () => {
3
- const { precision, rounding, minE, maxE, toExpNeg, toExpPos, crypto, modulo } = Numeric;
4
- const data = {
5
- precision,
6
- rounding,
7
- minE,
8
- maxE,
9
- toExpNeg,
10
- toExpPos,
11
- crypto,
12
- modulo,
13
- defaults: false,
14
- };
15
- return data;
16
- };
17
- export const setupNumericConfig = () => {
18
- const config = {
19
- precision: 256,
20
- //rounding: Numeric.ROUND_FLOOR,
21
- toExpNeg: Numeric.minE,
22
- toExpPos: Numeric.maxE,
23
- crypto: false,
24
- };
25
- Numeric.set({ defaults: true });
26
- Numeric.set(config);
27
- };
28
- //# sourceMappingURL=config.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.mjs","sourceRoot":"","sources":["../root/config.ts"],"names":[],"mappings":"OACO,EAAE,OAAO,EAAE;AAElB,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACxF,MAAM,IAAI,GAA6B;QACrC,SAAS;QACT,QAAQ;QACR,IAAI;QACJ,IAAI;QACJ,QAAQ;QACR,QAAQ;QACR,MAAM;QACN,MAAM;QACN,QAAQ,EAAE,KAAK;KAChB,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,MAAM,GAAmB;QAC7B,SAAS,EAAE,GAAG;QACd,gCAAgC;QAChC,QAAQ,EAAE,OAAO,CAAC,IAAI;QACtB,QAAQ,EAAE,OAAO,CAAC,IAAI;QACtB,MAAM,EAAE,KAAK;KACd,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC,CAAC"}
@@ -1,9 +0,0 @@
1
- import { Numeric } from './numeric';
2
- export declare const NegativeOne: Numeric;
3
- export declare const Zero: Numeric;
4
- export declare const One: Numeric;
5
- export declare const Two: Numeric;
6
- export declare const WeiPerEther: Numeric;
7
- export declare const MaxUint256: Numeric;
8
- export declare const MaxInt256: Numeric;
9
- export declare const MinInt256: Numeric;
package/lib/constants.js DELETED
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MinInt256 = exports.MaxInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.Two = exports.One = exports.Zero = exports.NegativeOne = void 0;
4
- const tslib_1 = require("tslib");
5
- const constants = tslib_1.__importStar(require("@ethersproject/constants"));
6
- const numeric_1 = require("./numeric.js");
7
- exports.NegativeOne = new numeric_1.Numeric(-1);
8
- exports.Zero = new numeric_1.Numeric(0);
9
- exports.One = new numeric_1.Numeric(1);
10
- exports.Two = new numeric_1.Numeric(2);
11
- exports.WeiPerEther = new numeric_1.Numeric(constants.WeiPerEther);
12
- exports.MaxUint256 = new numeric_1.Numeric(constants.MaxUint256);
13
- exports.MaxInt256 = new numeric_1.Numeric(constants.MaxInt256);
14
- exports.MinInt256 = new numeric_1.Numeric(constants.MinInt256);
15
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../root/constants.ts"],"names":[],"mappings":";;;;AAAA,4EAAsD;AACtD,0CAAoC;AAEvB,QAAA,WAAW,GAAG,IAAI,iBAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,QAAA,IAAI,GAAG,IAAI,iBAAO,CAAC,CAAC,CAAC,CAAC;AACtB,QAAA,GAAG,GAAG,IAAI,iBAAO,CAAC,CAAC,CAAC,CAAC;AACrB,QAAA,GAAG,GAAG,IAAI,iBAAO,CAAC,CAAC,CAAC,CAAC;AACrB,QAAA,WAAW,GAAG,IAAI,iBAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;AACjD,QAAA,UAAU,GAAG,IAAI,iBAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AAC/C,QAAA,SAAS,GAAG,IAAI,iBAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAC7C,QAAA,SAAS,GAAG,IAAI,iBAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC"}
package/lib/constants.mjs DELETED
@@ -1,11 +0,0 @@
1
- import * as constants from '@ethersproject/constants';
2
- import { Numeric } from "./numeric.mjs";
3
- export const NegativeOne = new Numeric(-1);
4
- export const Zero = new Numeric(0);
5
- export const One = new Numeric(1);
6
- export const Two = new Numeric(2);
7
- export const WeiPerEther = new Numeric(constants.WeiPerEther);
8
- export const MaxUint256 = new Numeric(constants.MaxUint256);
9
- export const MaxInt256 = new Numeric(constants.MaxInt256);
10
- export const MinInt256 = new Numeric(constants.MinInt256);
11
- //# sourceMappingURL=constants.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../root/constants.ts"],"names":[],"mappings":"OAAO,KAAK,SAAS,MAAM,0BAA0B;OAC9C,EAAE,OAAO,EAAE;AAElB,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;AAC9D,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AAC5D,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAC1D,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC"}
package/lib/format.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { NumericValue } from './numeric';
2
- export interface IFormatNumberOptions {
3
- negativeType?: 'right' | 'left' | 'brackets' | 'none';
4
- negativeLeftSymbol?: string;
5
- negativeRightSymbol?: string;
6
- negativeLeftOut?: boolean;
7
- negativeRightOut?: boolean;
8
- prefix?: string;
9
- suffix?: string;
10
- integerSeparator?: string;
11
- decimalsSeparator?: string;
12
- decimal?: string;
13
- padLeft?: number;
14
- padRight?: number;
15
- round?: number;
16
- truncate?: number;
17
- }
18
- export declare const formatValue: (value: NumericValue, options?: IFormatNumberOptions) => string;
package/lib/format.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatValue = void 0;
4
- const tslib_1 = require("tslib");
5
- const format_number_1 = tslib_1.__importDefault(require("format-number"));
6
- const numeric_1 = require("./numeric.js");
7
- const formatValue = (value, options) => {
8
- const format = (0, format_number_1.default)(options);
9
- const text = new numeric_1.Numeric(value).toFixed();
10
- return format(text);
11
- };
12
- exports.formatValue = formatValue;
13
- //# sourceMappingURL=format.js.map
package/lib/format.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.js","sourceRoot":"","sources":["../root/format.ts"],"names":[],"mappings":";;;;AAAA,0EAAsC;AACtC,0CAAkD;AAmB3C,MAAM,WAAW,GAAG,CAAC,KAAmB,EAAE,OAA8B,EAAE,EAAE;IACjF,MAAM,MAAM,GAAG,IAAA,uBAAS,EAAC,OAAO,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,IAAI,iBAAO,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IAC1C,OAAO,MAAM,CAAM,IAAI,CAAC,CAAC;AAC3B,CAAC,CAAC;AAJW,QAAA,WAAW,eAItB"}
package/lib/format.mjs DELETED
@@ -1,8 +0,0 @@
1
- import formatter from 'format-number';
2
- import { Numeric } from "./numeric.mjs";
3
- export const formatValue = (value, options) => {
4
- const format = formatter(options);
5
- const text = new Numeric(value).toFixed();
6
- return format(text);
7
- };
8
- //# sourceMappingURL=format.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.mjs","sourceRoot":"","sources":["../root/format.ts"],"names":[],"mappings":"OAAO,SAAS,MAAM,eAAe;OAC9B,EAAE,OAAO,EAAgB;AAmBhC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAmB,EAAE,OAA8B,EAAE,EAAE;IACjF,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IAC1C,OAAO,MAAM,CAAM,IAAI,CAAC,CAAC;AAC3B,CAAC,CAAC"}
package/lib/helper.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import { Numeric, NumericValue } from './numeric';
2
- export interface RangeOptions {
3
- includeMinimum?: boolean;
4
- includeMaximum?: boolean;
5
- }
6
- export declare const isRange: (value: NumericValue, minimum: NumericValue, maximum: NumericValue, options?: RangeOptions) => boolean;
7
- export declare const tryParse: (value: NumericValue) => false | Numeric;
8
- export declare const isInteger: (value: NumericValue) => boolean;
9
- export declare const isUnsignedIntegerBits: (bits: bigint, value: NumericValue) => boolean;
10
- export declare const isSignedIntegerBits: (bits: bigint, value: NumericValue) => boolean;
11
- export declare const createArrayCompareFunction: (ascending?: boolean) => (left: NumericValue, right: NumericValue) => number;
package/lib/helper.js DELETED
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createArrayCompareFunction = exports.isSignedIntegerBits = exports.isUnsignedIntegerBits = exports.isInteger = exports.tryParse = exports.isRange = void 0;
4
- const constants_1 = require("./constants.js");
5
- const numeric_1 = require("./numeric.js");
6
- const isRange = (value, minimum, maximum, options) => {
7
- try {
8
- const data = (0, numeric_1.toNumeric)(value);
9
- const defaultOptions = { includeMaximum: true, includeMinimum: true };
10
- const { includeMaximum, includeMinimum } = options ? Object.assign({}, defaultOptions, options) : defaultOptions;
11
- const isOverLower = includeMinimum ? data.lessThan(minimum) : data.lessThanOrEqualTo(minimum);
12
- const isOverUpper = includeMaximum ? data.greaterThan(maximum) : data.greaterThanOrEqualTo(maximum);
13
- return !(isOverLower || isOverUpper);
14
- }
15
- catch (error) {
16
- return false;
17
- }
18
- };
19
- exports.isRange = isRange;
20
- const tryParse = (value) => {
21
- try {
22
- return (0, numeric_1.toNumeric)(value);
23
- }
24
- catch (error) {
25
- return false;
26
- }
27
- };
28
- exports.tryParse = tryParse;
29
- const isInteger = (value) => {
30
- const data = (0, exports.tryParse)(value);
31
- return false !== data && data.isInteger();
32
- };
33
- exports.isInteger = isInteger;
34
- const isUnsignedIntegerBits = (bits, value) => {
35
- if (0n > bits || false === (0, exports.isInteger)(value)) {
36
- return false;
37
- }
38
- const maximum = constants_1.Two.toPower(bits);
39
- const minimum = constants_1.Zero;
40
- const options = { includeMinimum: true, includeMaximum: false };
41
- return (0, exports.isRange)(value, minimum, maximum, options);
42
- };
43
- exports.isUnsignedIntegerBits = isUnsignedIntegerBits;
44
- const isSignedIntegerBits = (bits, value) => {
45
- if (0n > bits || false === (0, exports.isInteger)(value)) {
46
- return false;
47
- }
48
- const maximum = constants_1.Two.toPower(bits - 1n);
49
- const minimum = constants_1.NegativeOne.times(maximum);
50
- const options = { includeMinimum: true, includeMaximum: false };
51
- return (0, exports.isRange)(value, minimum, maximum, options);
52
- };
53
- exports.isSignedIntegerBits = isSignedIntegerBits;
54
- const createArrayCompareFunction = (ascending = true) => ascending
55
- ? (left, right) => numeric_1.Numeric.sub(left, right).toNumber()
56
- : (left, right) => numeric_1.Numeric.sub(right, left).toNumber();
57
- exports.createArrayCompareFunction = createArrayCompareFunction;
58
- //# sourceMappingURL=helper.js.map
package/lib/helper.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","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uBAS9B;AAEK,MAAM,0BAA0B,GAAG,CAAC,YAAqB,IAAI,EAAE,EAAE,CACtE,SAAS;IACP,CAAC,CAAC,CAAC,IAAkB,EAAE,KAAmB,EAAE,EAAE,CAAC,iBAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE;IAClF,CAAC,CAAC,CAAC,IAAkB,EAAE,KAAmB,EAAE,EAAE,CAAC,iBAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;AAH1E,QAAA,0BAA0B,8BAGgD"}
package/lib/helper.mjs DELETED
@@ -1,49 +0,0 @@
1
- import { NegativeOne, Two, Zero } from "./constants.mjs";
2
- import { Numeric, toNumeric } from "./numeric.mjs";
3
- export const isRange = (value, minimum, maximum, options) => {
4
- try {
5
- const data = toNumeric(value);
6
- const defaultOptions = { includeMaximum: true, includeMinimum: true };
7
- const { includeMaximum, includeMinimum } = options ? Object.assign({}, defaultOptions, options) : defaultOptions;
8
- const isOverLower = includeMinimum ? data.lessThan(minimum) : data.lessThanOrEqualTo(minimum);
9
- const isOverUpper = includeMaximum ? data.greaterThan(maximum) : data.greaterThanOrEqualTo(maximum);
10
- return !(isOverLower || isOverUpper);
11
- }
12
- catch (error) {
13
- return false;
14
- }
15
- };
16
- export const tryParse = (value) => {
17
- try {
18
- return toNumeric(value);
19
- }
20
- catch (error) {
21
- return false;
22
- }
23
- };
24
- export const isInteger = (value) => {
25
- const data = tryParse(value);
26
- return false !== data && data.isInteger();
27
- };
28
- export const isUnsignedIntegerBits = (bits, value) => {
29
- if (0n > bits || false === isInteger(value)) {
30
- return false;
31
- }
32
- const maximum = Two.toPower(bits);
33
- const minimum = Zero;
34
- const options = { includeMinimum: true, includeMaximum: false };
35
- return isRange(value, minimum, maximum, options);
36
- };
37
- export const isSignedIntegerBits = (bits, value) => {
38
- if (0n > bits || false === isInteger(value)) {
39
- return false;
40
- }
41
- const maximum = Two.toPower(bits - 1n);
42
- const minimum = NegativeOne.times(maximum);
43
- const options = { includeMinimum: true, includeMaximum: false };
44
- return isRange(value, minimum, maximum, options);
45
- };
46
- export const createArrayCompareFunction = (ascending = true) => ascending
47
- ? (left, right) => Numeric.sub(left, right).toNumber()
48
- : (left, right) => Numeric.sub(right, left).toNumber();
49
- //# sourceMappingURL=helper.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helper.mjs","sourceRoot":"","sources":["../root/helper.ts"],"names":[],"mappings":"OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE;OAC1B,EAAE,OAAO,EAAgB,SAAS,EAAE;AAO3C,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAmB,EAAE,OAAqB,EAAE,OAAqB,EAAE,OAAsB,EAAE,EAAE;IACnH,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAC9B,MAAM,cAAc,GAA2B,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;QAC9F,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;QACjH,MAAM,WAAW,GAAG,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC9F,MAAM,WAAW,GAAG,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACpG,OAAO,CAAC,CAAC,WAAW,IAAI,WAAW,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAA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W,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAiB,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;IAC9E,OAAO,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,YAAqB,IAAI,EAAE,EAAE,CACtE,SAAS;IACP,CAAC,CAAC,CAAC,IAAkB,EAAE,KAAmB,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE;IAClF,CAAC,CAAC,CAAC,IAAkB,EAAE,KAAmB,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC"}
package/lib/index.d.ts DELETED
@@ -1,14 +0,0 @@
1
- export { Numeric, toBigInt, toBigInteger, toBigNumber, toBN, toIntegerString, toNumeric, toNumerics } from './numeric';
2
- export type { NumericValue } from './numeric';
3
- export { formatValue } from './format';
4
- export type { IFormatNumberOptions } from './format';
5
- export { getNumericConfig, setupNumericConfig } from './config';
6
- export { MaxInt256, MaxUint256, MinInt256, NegativeOne, One, Two, WeiPerEther, Zero } from './constants';
7
- export { createArrayCompareFunction, isInteger, isRange, isSignedIntegerBits, isUnsignedIntegerBits, tryParse, } from './helper';
8
- export type { RangeOptions } from './helper';
9
- /**
10
- * - must use `@types/node@16` for Symbol typing
11
- * - must put `@types/bn.js` in dependencies section of package.json
12
- * - must set `rootDir` to `src` that in compilerOptions section of tscnfig.json (for bundler tools)
13
- * - must import namespaces: `big-integer`, `bn.js`, `decimal.js`
14
- * */
package/lib/index.js DELETED
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tryParse = exports.isUnsignedIntegerBits = exports.isSignedIntegerBits = exports.isRange = exports.isInteger = 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
- var numeric_1 = require("./numeric.js");
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; } });
15
- var config_1 = require("./config.js");
16
- Object.defineProperty(exports, "getNumericConfig", { enumerable: true, get: function () { return config_1.getNumericConfig; } });
17
- Object.defineProperty(exports, "setupNumericConfig", { enumerable: true, get: function () { return config_1.setupNumericConfig; } });
18
- var constants_1 = require("./constants.js");
19
- Object.defineProperty(exports, "MaxInt256", { enumerable: true, get: function () { return constants_1.MaxInt256; } });
20
- Object.defineProperty(exports, "MaxUint256", { enumerable: true, get: function () { return constants_1.MaxUint256; } });
21
- Object.defineProperty(exports, "MinInt256", { enumerable: true, get: function () { return constants_1.MinInt256; } });
22
- Object.defineProperty(exports, "NegativeOne", { enumerable: true, get: function () { return constants_1.NegativeOne; } });
23
- Object.defineProperty(exports, "One", { enumerable: true, get: function () { return constants_1.One; } });
24
- Object.defineProperty(exports, "Two", { enumerable: true, get: function () { return constants_1.Two; } });
25
- Object.defineProperty(exports, "WeiPerEther", { enumerable: true, get: function () { return constants_1.WeiPerEther; } });
26
- Object.defineProperty(exports, "Zero", { enumerable: true, get: function () { return constants_1.Zero; } });
27
- var helper_1 = require("./helper.js");
28
- Object.defineProperty(exports, "createArrayCompareFunction", { enumerable: true, get: function () { return helper_1.createArrayCompareFunction; } });
29
- Object.defineProperty(exports, "isInteger", { enumerable: true, get: function () { return helper_1.isInteger; } });
30
- Object.defineProperty(exports, "isRange", { enumerable: true, get: function () { return helper_1.isRange; } });
31
- Object.defineProperty(exports, "isSignedIntegerBits", { enumerable: true, get: function () { return helper_1.isSignedIntegerBits; } });
32
- Object.defineProperty(exports, "isUnsignedIntegerBits", { enumerable: true, get: function () { return helper_1.isUnsignedIntegerBits; } });
33
- Object.defineProperty(exports, "tryParse", { enumerable: true, get: function () { return helper_1.tryParse; } });
34
- /**
35
- * - must use `@types/node@16` for Symbol typing
36
- * - must put `@types/bn.js` in dependencies section of package.json
37
- * - must set `rootDir` to `src` that in compilerOptions section of tscnfig.json (for bundler tools)
38
- * - must import namespaces: `big-integer`, `bn.js`, `decimal.js`
39
- * */
40
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../root/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;AAEnF,sCAOkB;AANhB,oHAAA,0BAA0B,OAAA;AAC1B,mGAAA,SAAS,OAAA;AACT,iGAAA,OAAO,OAAA;AACP,6GAAA,mBAAmB,OAAA;AACnB,+GAAA,qBAAqB,OAAA;AACrB,kGAAA,QAAQ,OAAA;AAIV;;;;;KAKK"}
package/lib/index.mjs DELETED
@@ -1,12 +0,0 @@
1
- export { Numeric, toBigInt, toBigInteger, toBigNumber, toBN, toIntegerString, toNumeric, toNumerics } from "./numeric.mjs";
2
- export { formatValue } from "./format.mjs";
3
- export { getNumericConfig, setupNumericConfig } from "./config.mjs";
4
- export { MaxInt256, MaxUint256, MinInt256, NegativeOne, One, Two, WeiPerEther, Zero } from "./constants.mjs";
5
- export { createArrayCompareFunction, isInteger, isRange, isSignedIntegerBits, isUnsignedIntegerBits, tryParse, } 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 import namespaces: `big-integer`, `bn.js`, `decimal.js`
11
- * */
12
- //# sourceMappingURL=index.mjs.map
package/lib/index.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../root/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;OAE9E,EACL,0BAA0B,EAC1B,SAAS,EACT,OAAO,EACP,mBAAmB,EACnB,qBAAqB,EACrB,QAAQ,GACT;AAGD;;;;;KAKK"}