@danielsimonjr/mathts-core 0.14.3 → 0.15.0
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/dist/arithmetic/scalar.d.ts +56 -0
- package/dist/arithmetic/scalar.d.ts.map +1 -0
- package/dist/array.d.ts +253 -0
- package/dist/array.d.ts.map +1 -0
- package/dist/bignumber-formatter.d.ts +135 -0
- package/dist/bignumber-formatter.d.ts.map +1 -0
- package/dist/collection.d.ts +67 -0
- package/dist/collection.d.ts.map +1 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/constants.d.ts +30 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/customs.d.ts +44 -0
- package/dist/customs.d.ts.map +1 -0
- package/dist/error/DimensionError.d.ts +26 -0
- package/dist/error/DimensionError.d.ts.map +1 -0
- package/dist/error/IndexError.d.ts +33 -0
- package/dist/error/IndexError.d.ts.map +1 -0
- package/dist/error/MathjsError.d.ts +13 -0
- package/dist/error/MathjsError.d.ts.map +1 -0
- package/dist/factory/factory.d.ts +154 -0
- package/dist/factory/factory.d.ts.map +1 -0
- package/dist/factory/index.d.ts +6 -0
- package/dist/factory/index.d.ts.map +1 -0
- package/dist/factory.d.ts +112 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/index.d.ts +24 -2593
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -13
- package/dist/internal.d.ts +33 -1344
- package/dist/internal.d.ts.map +1 -0
- package/dist/is.d.ts +102 -0
- package/dist/is.d.ts.map +1 -0
- package/dist/map.d.ts +113 -0
- package/dist/map.d.ts.map +1 -0
- package/dist/number.d.ts +314 -0
- package/dist/number.d.ts.map +1 -0
- package/dist/numeric/stable.d.ts +130 -0
- package/dist/numeric/stable.d.ts.map +1 -0
- package/dist/object.d.ts +119 -0
- package/dist/object.d.ts.map +1 -0
- package/dist/shared.d.ts +41 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/string.d.ts +70 -0
- package/dist/string.d.ts.map +1 -0
- package/dist/switch.d.ts +9 -0
- package/dist/switch.d.ts.map +1 -0
- package/dist/typed/index.d.ts +7 -0
- package/dist/typed/index.d.ts.map +1 -0
- package/dist/typed/mathts-typed.d.ts +246 -0
- package/dist/typed/mathts-typed.d.ts.map +1 -0
- package/dist/typed/type-bridge.d.ts +2 -0
- package/dist/typed/type-bridge.d.ts.map +1 -0
- package/dist/types/bignumber.d.ts +367 -0
- package/dist/types/bignumber.d.ts.map +1 -0
- package/dist/types/complex.d.ts +284 -0
- package/dist/types/complex.d.ts.map +1 -0
- package/dist/types/dual-rules.d.ts +129 -0
- package/dist/types/dual-rules.d.ts.map +1 -0
- package/dist/types/dual.d.ts +36 -0
- package/dist/types/dual.d.ts.map +1 -0
- package/dist/types/fraction.d.ts +215 -0
- package/dist/types/fraction.d.ts.map +1 -0
- package/dist/types/interfaces.d.ts +143 -0
- package/dist/types/interfaces.d.ts.map +1 -0
- package/dist/types/matrix/Range.d.ts +767 -0
- package/dist/types/matrix/Range.d.ts.map +1 -0
- package/dist/types/unit/Unit.d.ts +3 -0
- package/dist/types/unit/Unit.d.ts.map +1 -0
- package/dist/types/unit/dependencies.d.ts +4 -0
- package/dist/types/unit/dependencies.d.ts.map +1 -0
- package/dist/types/unit/errors.d.ts +18 -0
- package/dist/types/unit/errors.d.ts.map +1 -0
- package/dist/types/unit/index.d.ts +7 -0
- package/dist/types/unit/index.d.ts.map +1 -0
- package/dist/types/unit/unit-types.d.ts +231 -0
- package/dist/types/unit/unit-types.d.ts.map +1 -0
- package/dist/types/unit-definitions.d.ts +79 -0
- package/dist/types/unit-definitions.d.ts.map +1 -0
- package/dist/types/unit-prefixes.d.ts +29 -0
- package/dist/types/unit-prefixes.d.ts.map +1 -0
- package/dist/types/unit.d.ts +28 -0
- package/dist/types/unit.d.ts.map +1 -0
- package/dist/types/wasm-loader.d.ts +35 -0
- package/dist/types/wasm-loader.d.ts.map +1 -0
- package/dist/wasm-loader.d.ts +97 -0
- package/dist/wasm-loader.d.ts.map +1 -0
- package/package.json +8 -8
- package/dist/index-B4LIOfHN.d.ts +0 -449
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC1E,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AASpD,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAU7C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAoBrE,cAAc,cAAc,CAAC;AAM7B,OAAO,EACL,MAAM,IAAI,aAAa,EACvB,SAAS,EACT,MAAM,EACN,WAAW,EACX,KAAK,oBAAoB,GAC1B,MAAM,aAAa,CAAC;AAMrB,OAAO,EACL,MAAM,IAAI,eAAe,EACzB,aAAa,IAAI,sBAAsB,EACvC,aAAa,IAAI,sBAAsB,EACvC,OAAO,IAAI,gBAAgB,EAC3B,KAAK,cAAc,GACpB,MAAM,0BAA0B,CAAC;AAIlC,mBAAmB,4BAA4B,CAAC;AAMhD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAe5F,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EACL,SAAS,EACT,QAAQ,EACR,uBAAuB,EACvB,aAAa,EACb,YAAY,EACZ,MAAM,EACN,OAAO,EACP,oBAAoB,EACpB,OAAO,EACP,SAAS,EACT,OAAO,EACP,GAAG,EACH,OAAO,EACP,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,IAAI,EACJ,OAAO,EACP,MAAM,EACN,cAAc,EACd,sBAAsB,EACtB,WAAW,EACX,eAAe,EACf,OAAO,EACP,GAAG,IAAI,eAAe,EACtB,OAAO,IAAI,YAAY,EACvB,WAAW,IAAI,gBAAgB,EAC/B,KAAK,IAAI,UAAU,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,SAAS,EACT,QAAQ,EACR,MAAM,IAAI,SAAS,EACnB,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAOlB,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAc3E,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC"}
|
package/dist/is.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export interface BigNumber {
|
|
2
|
+
isBigNumber: boolean;
|
|
3
|
+
constructor: {
|
|
4
|
+
prototype: {
|
|
5
|
+
isBigNumber: boolean;
|
|
6
|
+
};
|
|
7
|
+
isDecimal?: (x: unknown) => boolean;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface Complex {
|
|
11
|
+
re: number;
|
|
12
|
+
im: number;
|
|
13
|
+
}
|
|
14
|
+
export interface Fraction {
|
|
15
|
+
n: number;
|
|
16
|
+
d: number;
|
|
17
|
+
}
|
|
18
|
+
export interface Unit {
|
|
19
|
+
constructor: {
|
|
20
|
+
prototype: {
|
|
21
|
+
isUnit: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface Matrix {
|
|
26
|
+
isMatrix?: boolean;
|
|
27
|
+
_size?: number[];
|
|
28
|
+
constructor: {
|
|
29
|
+
prototype: {
|
|
30
|
+
isMatrix: boolean;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface DenseMatrix extends Matrix {
|
|
35
|
+
isDenseMatrix: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface SparseMatrix extends Matrix {
|
|
38
|
+
isSparseMatrix: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface Range {
|
|
41
|
+
start: number;
|
|
42
|
+
end: number;
|
|
43
|
+
step: number;
|
|
44
|
+
constructor: {
|
|
45
|
+
prototype: {
|
|
46
|
+
isRange: boolean;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface IndexDimension {
|
|
51
|
+
_data?: unknown[];
|
|
52
|
+
_size: number[];
|
|
53
|
+
isRange?: boolean;
|
|
54
|
+
start?: number;
|
|
55
|
+
end?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface Index {
|
|
58
|
+
_dimensions: (IndexDimension | string)[];
|
|
59
|
+
_sourceSize?: (number | null)[];
|
|
60
|
+
constructor: {
|
|
61
|
+
prototype: {
|
|
62
|
+
isIndex: boolean;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export declare function isNumber(x: unknown): x is number;
|
|
67
|
+
export declare function isBigNumber(x: unknown): x is BigNumber;
|
|
68
|
+
export declare function isBigInt(x: unknown): x is bigint;
|
|
69
|
+
export declare function isComplex(x: unknown): x is Complex;
|
|
70
|
+
export declare function isFraction(x: unknown): x is Fraction;
|
|
71
|
+
export declare function isUnit(x: unknown): x is Unit;
|
|
72
|
+
export declare function isString(x: unknown): x is string;
|
|
73
|
+
export declare const isArray: (arg: any) => arg is any[];
|
|
74
|
+
export declare function isMatrix(x: unknown): x is Matrix;
|
|
75
|
+
/**
|
|
76
|
+
* Test whether a value is a collection: an Array or Matrix
|
|
77
|
+
* @param {*} x
|
|
78
|
+
* @returns {boolean} isCollection
|
|
79
|
+
*/
|
|
80
|
+
export declare function isCollection(x: unknown): x is unknown[] | Matrix;
|
|
81
|
+
export declare function isDenseMatrix(x: unknown): x is DenseMatrix;
|
|
82
|
+
export declare function isSparseMatrix(x: unknown): x is SparseMatrix;
|
|
83
|
+
export declare function isRange(x: unknown): x is Range;
|
|
84
|
+
export declare function isIndex(x: unknown): x is Index;
|
|
85
|
+
export declare function isBoolean(x: unknown): x is boolean;
|
|
86
|
+
export declare function isFunction(x: unknown): x is (...args: unknown[]) => unknown;
|
|
87
|
+
export declare function isDate(x: unknown): x is Date;
|
|
88
|
+
export declare function isRegExp(x: unknown): x is RegExp;
|
|
89
|
+
export declare function isObject(x: unknown): x is Record<string, unknown>;
|
|
90
|
+
/**
|
|
91
|
+
* Returns `true` if the passed object appears to be a Map (i.e. duck typing).
|
|
92
|
+
*
|
|
93
|
+
* Methods looked for are `get`, `set`, `keys` and `has`.
|
|
94
|
+
*
|
|
95
|
+
* @param {Map | object} object
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
export declare function isMap(object: unknown): object is Map<unknown, unknown>;
|
|
99
|
+
export declare function isNull(x: unknown): x is null;
|
|
100
|
+
export declare function isUndefined(x: unknown): x is undefined;
|
|
101
|
+
export declare function typeOf(x: unknown): string;
|
|
102
|
+
//# sourceMappingURL=is.d.ts.map
|
package/dist/is.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is.d.ts","sourceRoot":"","sources":["../src/is.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE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CAAC,IAAI,KAAK,CAE9C;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,OAAO,CAElD;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAE3E;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,IAAI,CAE5C;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAEhD;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQjE;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CActE;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,IAAI,CAE5C;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,SAAS,CAEtD;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAmBzC"}
|
package/dist/map.d.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A map facade on a bare object.
|
|
3
|
+
*
|
|
4
|
+
* The small number of methods needed to implement a scope,
|
|
5
|
+
* forwarding on to the SafeProperty functions. Over time, the codebase
|
|
6
|
+
* will stop using this method, as all objects will be Maps, rather than
|
|
7
|
+
* more security prone objects.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The iterator type `Map` itself declares, derived from the installed TS lib
|
|
11
|
+
* rather than hard-coded: older libs say `IterableIterator<[K, V]>`, TS >= 5.6
|
|
12
|
+
* says `MapIterator<[K, V]>` (which additionally requires `[Symbol.dispose]`).
|
|
13
|
+
* Deriving it keeps `implements Map<K, V>` honest on every TS version.
|
|
14
|
+
*/
|
|
15
|
+
type MapEntryIterator<K, V> = ReturnType<Map<K, V>[typeof Symbol.iterator]>;
|
|
16
|
+
export declare class ObjectWrappingMap<K = string, V = unknown> implements Map<K, V> {
|
|
17
|
+
wrappedObject: Record<string, V>;
|
|
18
|
+
readonly [Symbol.toStringTag]: string;
|
|
19
|
+
constructor(object: Record<string, V>);
|
|
20
|
+
/**
|
|
21
|
+
* Declared as a real method rather than assigned in the constructor through a
|
|
22
|
+
* cast. The old form satisfied the runtime but never appeared in the emitted
|
|
23
|
+
* type, so `implements Map<K, V>` was a lie that only surfaced downstream:
|
|
24
|
+
* consumers compiling with `skipLibCheck: false` got TS2420 ("incorrectly
|
|
25
|
+
* implements interface 'Map'... '[Symbol.iterator]' is missing").
|
|
26
|
+
*/
|
|
27
|
+
[Symbol.iterator](): MapEntryIterator<K, V>;
|
|
28
|
+
keys(): IterableIterator<K>;
|
|
29
|
+
get(key: K): V | undefined;
|
|
30
|
+
set(key: K, value: V): this;
|
|
31
|
+
has(key: K): boolean;
|
|
32
|
+
entries(): IterableIterator<[K, V]>;
|
|
33
|
+
values(): IterableIterator<V>;
|
|
34
|
+
forEach(callback: (value: V, key: K, map: Map<K, V>) => void): void;
|
|
35
|
+
delete(key: K): boolean;
|
|
36
|
+
clear(): void;
|
|
37
|
+
get size(): number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create a map with two partitions: a and b.
|
|
41
|
+
* The set with bKeys determines which keys/values are read/written to map b,
|
|
42
|
+
* all other values are read/written to map a
|
|
43
|
+
*
|
|
44
|
+
* For example:
|
|
45
|
+
*
|
|
46
|
+
* const a = new Map()
|
|
47
|
+
* const b = new Map()
|
|
48
|
+
* const p = new PartitionedMap(a, b, new Set(['x', 'y']))
|
|
49
|
+
*
|
|
50
|
+
* In this case, values `x` and `y` are read/written to map `b`,
|
|
51
|
+
* all other values are read/written to map `a`.
|
|
52
|
+
*/
|
|
53
|
+
export declare class PartitionedMap<K = unknown, V = unknown> implements Map<K, V> {
|
|
54
|
+
a: Map<K, V>;
|
|
55
|
+
b: Map<K, V>;
|
|
56
|
+
bKeys: Set<K>;
|
|
57
|
+
readonly [Symbol.toStringTag]: string;
|
|
58
|
+
/**
|
|
59
|
+
* @param a - Primary map
|
|
60
|
+
* @param b - Secondary map
|
|
61
|
+
* @param bKeys - Set of keys that should be read/written to map b
|
|
62
|
+
*/
|
|
63
|
+
constructor(a: Map<K, V>, b: Map<K, V>, bKeys: Set<K>);
|
|
64
|
+
/** See the note on `ObjectWrappingMap[Symbol.iterator]` — same fix. */
|
|
65
|
+
[Symbol.iterator](): MapEntryIterator<K, V>;
|
|
66
|
+
get(key: K): V | undefined;
|
|
67
|
+
set(key: K, value: V): this;
|
|
68
|
+
has(key: K): boolean;
|
|
69
|
+
keys(): IterableIterator<K>;
|
|
70
|
+
values(): IterableIterator<V>;
|
|
71
|
+
entries(): IterableIterator<[K, V]>;
|
|
72
|
+
forEach(callback: (value: V, key: K, map: Map<K, V>) => void): void;
|
|
73
|
+
delete(key: K): boolean;
|
|
74
|
+
clear(): void;
|
|
75
|
+
get size(): number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Creates an empty map, or whatever your platform's polyfill is.
|
|
79
|
+
*
|
|
80
|
+
* @returns an empty Map or Map like object.
|
|
81
|
+
*/
|
|
82
|
+
export declare function createEmptyMap<K = string, V = unknown>(): Map<K, V>;
|
|
83
|
+
/**
|
|
84
|
+
* Creates a Map from the given object.
|
|
85
|
+
*
|
|
86
|
+
* @param mapOrObject - Map or object to convert
|
|
87
|
+
* @returns Map instance
|
|
88
|
+
*/
|
|
89
|
+
export declare function createMap<K = string, V = unknown>(mapOrObject?: Map<K, V> | Record<string, V> | null): Map<K, V>;
|
|
90
|
+
/**
|
|
91
|
+
* Unwraps a map into an object.
|
|
92
|
+
*
|
|
93
|
+
* @param map - Map to convert to object
|
|
94
|
+
* @returns Plain object
|
|
95
|
+
*/
|
|
96
|
+
export declare function toObject<V = unknown>(map: Map<unknown, V>): Record<string, V>;
|
|
97
|
+
/**
|
|
98
|
+
* Copies the contents of key-value pairs from each `objects` in to `map`.
|
|
99
|
+
*
|
|
100
|
+
* Object is `objects` can be a `Map` or object.
|
|
101
|
+
*
|
|
102
|
+
* This is the `Map` analog to `Object.assign`.
|
|
103
|
+
*/
|
|
104
|
+
export declare function assign<K = unknown, V = unknown>(map: Map<K, V>, ...objects: (Map<K, V> | Record<string, V> | null | undefined)[]): Map<K, V>;
|
|
105
|
+
/**
|
|
106
|
+
* Returns `true` if `object` is an {@link ObjectWrappingMap}.
|
|
107
|
+
*
|
|
108
|
+
* Defined here, next to the class it guards, so `is.ts` need not import
|
|
109
|
+
* `map.ts` — that import was the sole edge closing the `is`/`map` cycle.
|
|
110
|
+
*/
|
|
111
|
+
export declare function isObjectWrappingMap(object: unknown): object is ObjectWrappingMap;
|
|
112
|
+
export {};
|
|
113
|
+
//# sourceMappingURL=map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":"AAmCA;;;;;;;GAOG;AACH;;;;;GAKG;AACH,KAAK,gBAAgB,CAAC,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE5E,qBAAa,iBAAiB,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,OAAO,CAAE,YAAW,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1E,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACjC,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAAuB;IAE5D,YAAY,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAA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E,CAAC,CAAC,CAYX;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAU7E;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAC7C,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EACd,GAAG,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAC/D,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAgBX;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,iBAAiB,CAIhF"}
|
package/dist/number.d.ts
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split value representation with sign, coefficients, and exponent
|
|
3
|
+
*/
|
|
4
|
+
export interface SplitValue {
|
|
5
|
+
sign: '+' | '-' | '';
|
|
6
|
+
coefficients: number[];
|
|
7
|
+
exponent: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Configuration for number type handling
|
|
11
|
+
*/
|
|
12
|
+
export interface NumberTypeConfig {
|
|
13
|
+
number: 'number' | 'BigNumber' | 'bigint' | 'Fraction';
|
|
14
|
+
numberFallback: 'number' | 'BigNumber';
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Format options for number formatting
|
|
18
|
+
*/
|
|
19
|
+
export interface FormatOptions {
|
|
20
|
+
notation?: 'auto' | 'exponential' | 'fixed' | 'engineering' | 'bin' | 'oct' | 'hex';
|
|
21
|
+
precision?: number;
|
|
22
|
+
wordSize?: number;
|
|
23
|
+
lowerExp?: number;
|
|
24
|
+
upperExp?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Normalized format options
|
|
28
|
+
*/
|
|
29
|
+
export interface NormalizedFormatOptions {
|
|
30
|
+
notation: 'auto' | 'exponential' | 'fixed' | 'engineering' | 'bin' | 'oct' | 'hex';
|
|
31
|
+
precision: number | undefined;
|
|
32
|
+
wordSize: number | undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Check if a number is integer
|
|
36
|
+
* @param value The value to check
|
|
37
|
+
* @return true if value is an integer
|
|
38
|
+
*/
|
|
39
|
+
export declare function isInteger(value: number | boolean): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Ensure the number type is compatible with the provided value.
|
|
42
|
+
* If not, return 'number' instead.
|
|
43
|
+
*
|
|
44
|
+
* For example:
|
|
45
|
+
*
|
|
46
|
+
* safeNumberType('2.3', { number: 'bigint', numberFallback: 'number' })
|
|
47
|
+
*
|
|
48
|
+
* will return 'number' and not 'bigint' because trying to create a bigint with
|
|
49
|
+
* value 2.3 would throw an exception.
|
|
50
|
+
*
|
|
51
|
+
* @param numberStr The number as a string
|
|
52
|
+
* @param config Configuration with number type preferences
|
|
53
|
+
* @returns The safe number type to use
|
|
54
|
+
*/
|
|
55
|
+
export declare function safeNumberType(numberStr: string, config: NumberTypeConfig): 'number' | 'BigNumber' | 'bigint' | 'Fraction';
|
|
56
|
+
/**
|
|
57
|
+
* Calculate the sign of a number
|
|
58
|
+
* @param x The number
|
|
59
|
+
* @returns 1 for positive, -1 for negative, 0 for zero
|
|
60
|
+
*/
|
|
61
|
+
export declare const sign: (x: number) => number;
|
|
62
|
+
/**
|
|
63
|
+
* Calculate the base-2 logarithm of a number
|
|
64
|
+
* @param x The number
|
|
65
|
+
* @returns The base-2 logarithm
|
|
66
|
+
*/
|
|
67
|
+
export declare const log2: (x: number) => number;
|
|
68
|
+
/**
|
|
69
|
+
* Calculate the base-10 logarithm of a number
|
|
70
|
+
* @param x The number
|
|
71
|
+
* @returns The base-10 logarithm
|
|
72
|
+
*/
|
|
73
|
+
export declare const log10: (x: number) => number;
|
|
74
|
+
/**
|
|
75
|
+
* Calculate the natural logarithm of a number + 1
|
|
76
|
+
* @param x The number
|
|
77
|
+
* @returns ln(x + 1)
|
|
78
|
+
*/
|
|
79
|
+
export declare const log1p: (x: number) => number;
|
|
80
|
+
/**
|
|
81
|
+
* Calculate cubic root for a number
|
|
82
|
+
*
|
|
83
|
+
* Code from es6-shim.js:
|
|
84
|
+
* https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L1564-L1577
|
|
85
|
+
*
|
|
86
|
+
* @param x The number
|
|
87
|
+
* @returns The cubic root of x
|
|
88
|
+
*/
|
|
89
|
+
export declare const cbrt: (x: number) => number;
|
|
90
|
+
/**
|
|
91
|
+
* Calculates exponentiation minus 1
|
|
92
|
+
* @param x The exponent
|
|
93
|
+
* @return exp(x) - 1
|
|
94
|
+
*/
|
|
95
|
+
export declare const expm1: (x: number) => number;
|
|
96
|
+
/**
|
|
97
|
+
* Convert a number to a formatted string representation.
|
|
98
|
+
*
|
|
99
|
+
* Syntax:
|
|
100
|
+
*
|
|
101
|
+
* format(value)
|
|
102
|
+
* format(value, options)
|
|
103
|
+
* format(value, precision)
|
|
104
|
+
* format(value, fn)
|
|
105
|
+
*
|
|
106
|
+
* Where:
|
|
107
|
+
*
|
|
108
|
+
* {number} value The value to be formatted
|
|
109
|
+
* {Object} options An object with formatting options. Available options:
|
|
110
|
+
* {string} notation
|
|
111
|
+
* Number notation. Choose from:
|
|
112
|
+
* 'fixed' Always use regular number notation.
|
|
113
|
+
* For example '123.40' and '14000000'
|
|
114
|
+
* 'exponential' Always use exponential notation.
|
|
115
|
+
* For example '1.234e+2' and '1.4e+7'
|
|
116
|
+
* 'engineering' Always use engineering notation.
|
|
117
|
+
* For example '123.4e+0' and '14.0e+6'
|
|
118
|
+
* 'auto' (default) Regular number notation for numbers
|
|
119
|
+
* having an absolute value between
|
|
120
|
+
* `lowerExp` and `upperExp` bounds, and
|
|
121
|
+
* uses exponential notation elsewhere.
|
|
122
|
+
* Lower bound is included, upper bound
|
|
123
|
+
* is excluded.
|
|
124
|
+
* For example '123.4' and '1.4e7'.
|
|
125
|
+
* 'bin', 'oct, or
|
|
126
|
+
* 'hex' Format the number using binary, octal,
|
|
127
|
+
* or hexadecimal notation.
|
|
128
|
+
* For example '0b1101' and '0x10fe'.
|
|
129
|
+
* {number} wordSize The word size in bits to use for formatting
|
|
130
|
+
* in binary, octal, or hexadecimal notation.
|
|
131
|
+
* To be used only with 'bin', 'oct', or 'hex'
|
|
132
|
+
* values for 'notation' option. When this option
|
|
133
|
+
* is defined the value is formatted as a signed
|
|
134
|
+
* twos complement integer of the given word size
|
|
135
|
+
* and the size suffix is appended to the output.
|
|
136
|
+
* For example
|
|
137
|
+
* format(-1, {notation: 'hex', wordSize: 8}) === '0xffi8'.
|
|
138
|
+
* Default value is undefined.
|
|
139
|
+
* {number} precision A number between 0 and 16 to round
|
|
140
|
+
* the digits of the number.
|
|
141
|
+
* In case of notations 'exponential',
|
|
142
|
+
* 'engineering', and 'auto',
|
|
143
|
+
* `precision` defines the total
|
|
144
|
+
* number of significant digits returned.
|
|
145
|
+
* In case of notation 'fixed',
|
|
146
|
+
* `precision` defines the number of
|
|
147
|
+
* significant digits after the decimal
|
|
148
|
+
* point.
|
|
149
|
+
* `precision` is undefined by default,
|
|
150
|
+
* not rounding any digits.
|
|
151
|
+
* {number} lowerExp Exponent determining the lower boundary
|
|
152
|
+
* for formatting a value with an exponent
|
|
153
|
+
* when `notation='auto`.
|
|
154
|
+
* Default value is `-3`.
|
|
155
|
+
* {number} upperExp Exponent determining the upper boundary
|
|
156
|
+
* for formatting a value with an exponent
|
|
157
|
+
* when `notation='auto`.
|
|
158
|
+
* Default value is `5`.
|
|
159
|
+
* {Function} fn A custom formatting function. Can be used to override the
|
|
160
|
+
* built-in notations. Function `fn` is called with `value` as
|
|
161
|
+
* parameter and must return a string. Is useful for example to
|
|
162
|
+
* format all values inside a matrix in a particular way.
|
|
163
|
+
*
|
|
164
|
+
* Examples:
|
|
165
|
+
*
|
|
166
|
+
* format(6.4) // '6.4'
|
|
167
|
+
* format(1240000) // '1.24e6'
|
|
168
|
+
* format(1/3) // '0.3333333333333333'
|
|
169
|
+
* format(1/3, 3) // '0.333'
|
|
170
|
+
* format(21385, 2) // '21000'
|
|
171
|
+
* format(12.071, {notation: 'fixed'}) // '12'
|
|
172
|
+
* format(2.3, {notation: 'fixed', precision: 2}) // '2.30'
|
|
173
|
+
* format(52.8, {notation: 'exponential'}) // '5.28e+1'
|
|
174
|
+
* format(12345678, {notation: 'engineering'}) // '12.345678e+6'
|
|
175
|
+
*
|
|
176
|
+
* @param value The number to format
|
|
177
|
+
* @param options Optional formatting options or custom formatter function or precision
|
|
178
|
+
* @return The formatted value
|
|
179
|
+
*/
|
|
180
|
+
export declare function format(value: number, options?: FormatOptions | ((value: number) => string) | number): string;
|
|
181
|
+
/**
|
|
182
|
+
* Normalize format options into an object:
|
|
183
|
+
* {
|
|
184
|
+
* notation: string,
|
|
185
|
+
* precision: number | undefined,
|
|
186
|
+
* wordSize: number | undefined
|
|
187
|
+
* }
|
|
188
|
+
* @param options The input options
|
|
189
|
+
* @returns Normalized format options
|
|
190
|
+
*/
|
|
191
|
+
export declare function normalizeFormatOptions(options?: FormatOptions | number): NormalizedFormatOptions;
|
|
192
|
+
/**
|
|
193
|
+
* Split a number into sign, coefficients, and exponent
|
|
194
|
+
* @param value The number or string to split
|
|
195
|
+
* @return Object containing sign, coefficients, and exponent
|
|
196
|
+
*/
|
|
197
|
+
export declare function splitNumber(value: number | string): SplitValue;
|
|
198
|
+
/**
|
|
199
|
+
* Format a number in engineering notation. Like '1.23e+6', '2.3e+0', '3.500e-3'
|
|
200
|
+
* @param value The number or string to format
|
|
201
|
+
* @param precision Optional number of significant figures to return
|
|
202
|
+
* @returns The formatted string
|
|
203
|
+
*/
|
|
204
|
+
export declare function toEngineering(value: number | string, precision?: number): string;
|
|
205
|
+
/**
|
|
206
|
+
* Format a number with fixed notation.
|
|
207
|
+
* @param value The number or string to format
|
|
208
|
+
* @param precision Optional number of decimals after the decimal point
|
|
209
|
+
* @returns The formatted string
|
|
210
|
+
*/
|
|
211
|
+
export declare function toFixed(value: number | string, precision?: number): string;
|
|
212
|
+
/**
|
|
213
|
+
* Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3'
|
|
214
|
+
* @param value The number or string to format
|
|
215
|
+
* @param precision Number of digits in formatted output
|
|
216
|
+
* @returns The formatted string
|
|
217
|
+
*/
|
|
218
|
+
export declare function toExponential(value: number | string, precision?: number): string;
|
|
219
|
+
/**
|
|
220
|
+
* Format a number with a certain precision
|
|
221
|
+
* @param value The number or string to format
|
|
222
|
+
* @param precision Optional number of digits
|
|
223
|
+
* @param options Optional formatting options (lowerExp, upperExp)
|
|
224
|
+
* @return The formatted string
|
|
225
|
+
*/
|
|
226
|
+
export declare function toPrecision(value: number | string, precision?: number, options?: FormatOptions): string;
|
|
227
|
+
/**
|
|
228
|
+
* Round the number of digits of a number
|
|
229
|
+
* @param split A value split with .splitNumber(value)
|
|
230
|
+
* @param precision A positive integer
|
|
231
|
+
* @return Object containing sign, coefficients, and exponent with rounded digits
|
|
232
|
+
*/
|
|
233
|
+
export declare function roundDigits(split: SplitValue, precision?: number): SplitValue;
|
|
234
|
+
/**
|
|
235
|
+
* Count the number of significant digits of a number.
|
|
236
|
+
*
|
|
237
|
+
* For example:
|
|
238
|
+
* 2.34 returns 3
|
|
239
|
+
* 0.0034 returns 2
|
|
240
|
+
* 120.5e+30 returns 4
|
|
241
|
+
*
|
|
242
|
+
* @param value The number
|
|
243
|
+
* @return Number of significant digits
|
|
244
|
+
*/
|
|
245
|
+
export declare function digits(value: number): number;
|
|
246
|
+
/**
|
|
247
|
+
* Compares two floating point numbers.
|
|
248
|
+
* @param a First value to compare
|
|
249
|
+
* @param b Second value to compare
|
|
250
|
+
* @param relTol The relative tolerance, indicating the maximum allowed difference relative to the larger absolute value. Must be greater than 0.
|
|
251
|
+
* @param absTol The minimum absolute tolerance, useful for comparisons near zero. Must be at least 0.
|
|
252
|
+
* @return whether the two numbers are nearly equal
|
|
253
|
+
*
|
|
254
|
+
* @throws Error If `relTol` is less than or equal to 0.
|
|
255
|
+
* @throws Error If `absTol` is less than 0.
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* nearlyEqual(1.000000001, 1.0, 1e-8); // true
|
|
259
|
+
* nearlyEqual(1.000000002, 1.0, 0); // false
|
|
260
|
+
* nearlyEqual(1.0, 1.009, undefined, 0.01); // true
|
|
261
|
+
* nearlyEqual(0.000000001, 0.0, undefined, 1e-8); // true
|
|
262
|
+
*/
|
|
263
|
+
export declare function nearlyEqual(a: number, b: number, relTol?: number, absTol?: number): boolean;
|
|
264
|
+
/**
|
|
265
|
+
* Calculate the hyperbolic arccos of a number
|
|
266
|
+
* @param x The number
|
|
267
|
+
* @return The hyperbolic arccosine
|
|
268
|
+
*/
|
|
269
|
+
export declare const acosh: (x: number) => number;
|
|
270
|
+
/**
|
|
271
|
+
* Calculate the hyperbolic arcsine of a number
|
|
272
|
+
* @param x The number
|
|
273
|
+
* @return The hyperbolic arcsine
|
|
274
|
+
*/
|
|
275
|
+
export declare const asinh: (x: number) => number;
|
|
276
|
+
/**
|
|
277
|
+
* Calculate the hyperbolic arctangent of a number
|
|
278
|
+
* @param x The number
|
|
279
|
+
* @return The hyperbolic arctangent
|
|
280
|
+
*/
|
|
281
|
+
export declare const atanh: (x: number) => number;
|
|
282
|
+
/**
|
|
283
|
+
* Calculate the hyperbolic cosine of a number
|
|
284
|
+
* @param x The number
|
|
285
|
+
* @returns The hyperbolic cosine
|
|
286
|
+
*/
|
|
287
|
+
export declare const cosh: (x: number) => number;
|
|
288
|
+
/**
|
|
289
|
+
* Calculate the hyperbolic sine of a number
|
|
290
|
+
* @param x The number
|
|
291
|
+
* @returns The hyperbolic sine
|
|
292
|
+
*/
|
|
293
|
+
export declare const sinh: (x: number) => number;
|
|
294
|
+
/**
|
|
295
|
+
* Calculate the hyperbolic tangent of a number
|
|
296
|
+
* @param x The number
|
|
297
|
+
* @returns The hyperbolic tangent
|
|
298
|
+
*/
|
|
299
|
+
export declare const tanh: (x: number) => number;
|
|
300
|
+
/**
|
|
301
|
+
* Returns a value with the magnitude of x and the sign of y.
|
|
302
|
+
* @param x The value providing the magnitude
|
|
303
|
+
* @param y The value providing the sign
|
|
304
|
+
* @returns Value with magnitude of x and sign of y
|
|
305
|
+
*/
|
|
306
|
+
export declare function copysign(x: number, y: number): number;
|
|
307
|
+
/**
|
|
308
|
+
* Check if x^y is 0 due to infinity
|
|
309
|
+
* @param x The base
|
|
310
|
+
* @param y The exponent
|
|
311
|
+
* @returns true if x^y is 0 due to infinity
|
|
312
|
+
*/
|
|
313
|
+
export declare function isPowZeroAtInfinity(x: number, y: number): boolean;
|
|
314
|
+
//# sourceMappingURL=number.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../src/number.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;IACvD,cAAc,EAAE,QAAQ,GAAG,WAAW,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,OAAO,GAAG,aAAa,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE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