@danielsimonjr/mathts-functions 0.42.0 → 0.43.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/error/DimensionError.d.ts +11 -12
- package/dist/error/DimensionError.d.ts.map +1 -1
- package/dist/error/IndexError.d.ts +13 -19
- package/dist/error/IndexError.d.ts.map +1 -1
- package/dist/factories/index.d.ts.map +1 -1
- package/dist/factories/matrix-bridge.d.ts +1 -1
- package/dist/factories/scope.d.ts +1 -1
- package/dist/index.js +400 -1341
- package/dist/typed/arithmetic.d.ts.map +1 -1
- package/dist/typed/bitwise.d.ts +1 -1
- package/dist/typed/probability.d.ts +2 -2
- package/dist/typed/relational.d.ts +3 -3
- package/dist/typed/string.d.ts +3 -3
- package/dist/typed/typed-bridge.d.ts +1 -1
- package/dist/utils/array.d.ts +20 -237
- package/dist/utils/array.d.ts.map +1 -1
- package/dist/utils/collection.d.ts +12 -64
- package/dist/utils/collection.d.ts.map +1 -1
- package/dist/utils/factory.d.ts +42 -53
- package/dist/utils/factory.d.ts.map +1 -1
- package/dist/utils/map.d.ts +30 -103
- package/dist/utils/map.d.ts.map +1 -1
- package/dist/utils/string.d.ts +15 -59
- package/dist/utils/string.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/error/MathjsError.d.ts +0 -13
- package/dist/error/MathjsError.d.ts.map +0 -1
- package/dist/utils/bignumber/formatter.d.ts +0 -136
- package/dist/utils/bignumber/formatter.d.ts.map +0 -1
package/dist/utils/map.d.ts
CHANGED
|
@@ -1,106 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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 = unknown, 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 = unknown, V = unknown>(mapOrObject?: Map<K, V> | Record<string, V> | null): Map<K, V>;
|
|
90
|
-
/**
|
|
91
|
-
* Copies the contents of key-value pairs from each `objects` in to `map`.
|
|
92
|
-
*
|
|
93
|
-
* Object is `objects` can be a `Map` or object.
|
|
94
|
-
*
|
|
95
|
-
* This is the `Map` analog to `Object.assign`.
|
|
96
|
-
*/
|
|
97
|
-
export declare function assign<K = unknown, V = unknown>(map: Map<K, V>, ...objects: (Map<K, V> | Record<string, V> | null | undefined)[]): Map<K, V>;
|
|
98
|
-
/**
|
|
99
|
-
* Returns `true` if `object` is an {@link ObjectWrappingMap}.
|
|
100
|
-
*
|
|
101
|
-
* Defined here, next to the class it guards, so `is.ts` need not import
|
|
102
|
-
* `map.ts` — that import was the sole edge closing the `is`/`map` cycle.
|
|
2
|
+
* A `Map`-facade over a bare object (`ObjectWrappingMap`), a two-partition
|
|
3
|
+
* `Map` (`PartitionedMap`), and small `Map`/object interop helpers
|
|
4
|
+
* (`createMap`/`createEmptyMap`/`assign`).
|
|
5
|
+
*
|
|
6
|
+
* Consolidated onto core: the implementation lives once in
|
|
7
|
+
* `@danielsimonjr/mathts-core/internal` (see `core/src/map.ts` and the
|
|
8
|
+
* `project-all-libraries-build-on-core` principle). Thin re-export so existing
|
|
9
|
+
* `../utils/map.js` imports keep working while the single source of truth lives
|
|
10
|
+
* in core. Proven equivalent to the prior local copy (and to `expression`'s copy)
|
|
11
|
+
* via a fast-check property harness before the redirect — see
|
|
12
|
+
* `functions/tests/dedup-bucketB-equivalence.test.ts`.
|
|
13
|
+
*
|
|
14
|
+
* TWO divergences were found and reconciled onto core (see `core/src/map.ts`'s
|
|
15
|
+
* header for the full writeup):
|
|
16
|
+
* 1. `[Symbol.iterator]` — THIS package's prior copy already declared it as a
|
|
17
|
+
* real, correctly-typed class method (the fix `expression`'s copy was
|
|
18
|
+
* missing); core's canonical adopts this package's version unchanged.
|
|
19
|
+
* 2. `createEmptyMap`/`createMap`'s generic default (`K = unknown` here vs.
|
|
20
|
+
* `K = string` in `expression`) — a compile-time-only inference default with
|
|
21
|
+
* no behavioral difference; reconciled to core's `K = string` (matching
|
|
22
|
+
* `ObjectWrappingMap`/`PartitionedMap`'s own `K = string` default already
|
|
23
|
+
* shared by both packages). No call site in this package relies on the
|
|
24
|
+
* `K = unknown` default (checked: `functions/src/algebra/simplify.ts`'s
|
|
25
|
+
* `createEmptyMap()` call is assigned to an explicitly `Map<string, unknown>`-
|
|
26
|
+
* typed parameter default, which `Map<string, unknown>` satisfies directly).
|
|
27
|
+
*
|
|
28
|
+
* This package never had `toObject` (unlike `expression`'s prior copy, consumed
|
|
29
|
+
* by its `Parser.ts`), so it is intentionally not re-exported here — this shim
|
|
30
|
+
* preserves exactly the original export surface.
|
|
103
31
|
*/
|
|
104
|
-
export
|
|
105
|
-
export {};
|
|
32
|
+
export { ObjectWrappingMap, PartitionedMap, createEmptyMap, createMap, assignMap as assign, isObjectWrappingMap, } from '@danielsimonjr/mathts-core/internal';
|
|
106
33
|
//# sourceMappingURL=map.d.ts.map
|
package/dist/utils/map.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/utils/map.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/utils/map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,SAAS,EACT,SAAS,IAAI,MAAM,EACnB,mBAAmB,GACpB,MAAM,qCAAqC,CAAC"}
|
package/dist/utils/string.d.ts
CHANGED
|
@@ -1,64 +1,20 @@
|
|
|
1
|
-
import { type FormatOptions } from './number.js';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
* numeric {@link FormatOptions} with the string-level `truncate` and the
|
|
5
|
-
* fraction rendering mode, or is a precision number, or a custom formatter.
|
|
6
|
-
*/
|
|
7
|
-
export type GeneralFormatOptions = number | ((value: unknown) => string) | (FormatOptions & {
|
|
8
|
-
truncate?: number;
|
|
9
|
-
fraction?: 'ratio' | 'decimal';
|
|
10
|
-
});
|
|
11
|
-
/**
|
|
12
|
-
* Format a value of any type into a string.
|
|
13
|
-
*
|
|
14
|
-
* Usage:
|
|
15
|
-
* math.format(value)
|
|
16
|
-
* math.format(value, precision)
|
|
17
|
-
* math.format(value, options)
|
|
18
|
-
*
|
|
19
|
-
* When value is a function:
|
|
20
|
-
*
|
|
21
|
-
* - When the function has a property `syntax`, it returns this
|
|
22
|
-
* syntax description.
|
|
23
|
-
* - In other cases, a string `'function'` is returned.
|
|
24
|
-
*
|
|
25
|
-
* When `value` is an Object:
|
|
2
|
+
* Generic-value string formatting (`format`, `stringify`, `compareText`).
|
|
26
3
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* -
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
4
|
+
* Consolidated onto core: the implementations live once in
|
|
5
|
+
* `@danielsimonjr/mathts-core/internal` (see `number.ts`/`object.ts` and the
|
|
6
|
+
* `project-all-libraries-build-on-core` principle). Thin re-export so existing
|
|
7
|
+
* `../utils/string.js` imports keep working while the single source of truth
|
|
8
|
+
* lives in core. Proven equivalent to the prior local copy (and to `expression`'s
|
|
9
|
+
* copy) via a fast-check property harness before the redirect — see
|
|
10
|
+
* `functions/tests/dedup-bucketB-equivalence.test.ts`.
|
|
33
11
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @param {*} value Value to be stringified
|
|
41
|
-
* @param {Object | number | Function} [options]
|
|
42
|
-
* Formatting options. See src/utils/number.js:format for a
|
|
43
|
-
* description of the available options controlling number output.
|
|
44
|
-
* This generic "format" also supports the option property `truncate: NN`
|
|
45
|
-
* giving the maximum number NN of characters to return (if there would
|
|
46
|
-
* have been more, they are deleted and replaced by an ellipsis).
|
|
47
|
-
* @return {string} str
|
|
48
|
-
*/
|
|
49
|
-
export declare function format(value: unknown, options?: unknown): string;
|
|
50
|
-
/**
|
|
51
|
-
* Stringify a value into a string enclosed in double quotes.
|
|
52
|
-
* Unescaped double quotes and backslashes inside the value are escaped.
|
|
53
|
-
* @param {*} value
|
|
54
|
-
* @return {string}
|
|
55
|
-
*/
|
|
56
|
-
export declare function stringify(value: unknown): string;
|
|
57
|
-
/**
|
|
58
|
-
* Compare two strings
|
|
59
|
-
* @param {string} x
|
|
60
|
-
* @param {string} y
|
|
61
|
-
* @returns {number}
|
|
12
|
+
* NOTE: core exports the generic `format` here as `formatGeneric` (its `number.ts`
|
|
13
|
+
* already exports a `format` for plain numbers from the same `internal.ts` barrel,
|
|
14
|
+
* so an unaliased re-export would collide); re-exported here under the original
|
|
15
|
+
* local name `format`. This package never had `escape`/`endsWith` in this file
|
|
16
|
+
* (unlike `expression`'s prior copy), so they are intentionally not re-exported
|
|
17
|
+
* here — this shim preserves exactly the original export surface.
|
|
62
18
|
*/
|
|
63
|
-
export
|
|
19
|
+
export { formatGeneric as format, stringify, compareText, type GeneralFormatOptions, } from '@danielsimonjr/mathts-core/internal';
|
|
64
20
|
//# sourceMappingURL=string.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EACL,aAAa,IAAI,MAAM,EACvB,SAAS,EACT,WAAW,EACX,KAAK,oBAAoB,GAC1B,MAAM,qCAAqC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielsimonjr/mathts-functions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"description": "Mathematical functions for MathTS - arithmetic, algebra, trigonometry, statistics, and more",
|
|
5
5
|
"author": "Daniel Simon Jr.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"build:prod": "tsup src/index.ts --format esm --clean --minify --treeshake"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@danielsimonjr/mathts-core": "^0.
|
|
38
|
-
"@danielsimonjr/mathts-expression": "^0.6.
|
|
37
|
+
"@danielsimonjr/mathts-core": "^0.11.0",
|
|
38
|
+
"@danielsimonjr/mathts-expression": "^0.6.5",
|
|
39
39
|
"@danielsimonjr/mathts-gpu": "^0.2.0",
|
|
40
|
-
"@danielsimonjr/mathts-matrix": "^0.6.
|
|
41
|
-
"@danielsimonjr/mathts-parallel": "^0.6.
|
|
40
|
+
"@danielsimonjr/mathts-matrix": "^0.6.1",
|
|
41
|
+
"@danielsimonjr/mathts-parallel": "^0.6.1",
|
|
42
42
|
"bignumber.js": "^9.1.2",
|
|
43
43
|
"complex.js": "^2.2.5",
|
|
44
44
|
"decimal.js": "^10.4.3",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom error type for Mathjs errors
|
|
3
|
-
* @extends Error
|
|
4
|
-
*/
|
|
5
|
-
export declare class MathjsError extends Error {
|
|
6
|
-
isMathjsError: true;
|
|
7
|
-
/**
|
|
8
|
-
* Create a MathjsError
|
|
9
|
-
* @param message Error message
|
|
10
|
-
*/
|
|
11
|
-
constructor(message: string);
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=MathjsError.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MathjsError.d.ts","sourceRoot":"","sources":["../../src/error/MathjsError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,aAAa,EAAG,IAAI,CAAU;IAE9B;;;OAGG;gBACS,OAAO,EAAE,MAAM;CAY5B"}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Structural contract for the BigNumber values handled by this formatter.
|
|
3
|
-
* Captures exactly the methods/properties used here. The configured BigNumber
|
|
4
|
-
* implementation (e.g. decimal.js) provides these; the project's `BigNumber`
|
|
5
|
-
* type alias points at a minimal local Decimal that does not declare them all,
|
|
6
|
-
* so we model the runtime contract explicitly.
|
|
7
|
-
*/
|
|
8
|
-
interface BigNumberValue {
|
|
9
|
-
e: number;
|
|
10
|
-
constructor: new (value: number | string) => BigNumberValue;
|
|
11
|
-
isFinite(): boolean;
|
|
12
|
-
isNaN(): boolean;
|
|
13
|
-
isZero(): boolean;
|
|
14
|
-
isInteger(): boolean;
|
|
15
|
-
gt(other: number | BigNumberValue): boolean;
|
|
16
|
-
greaterThan(other: number | BigNumberValue): boolean;
|
|
17
|
-
lessThan(other: number | BigNumberValue): boolean;
|
|
18
|
-
add(other: number | BigNumberValue): BigNumberValue;
|
|
19
|
-
sub(other: number | BigNumberValue): BigNumberValue;
|
|
20
|
-
mul(other: number | BigNumberValue): BigNumberValue;
|
|
21
|
-
pow(exp: number | BigNumberValue): BigNumberValue;
|
|
22
|
-
toNumber(): number;
|
|
23
|
-
toFixed(places?: number): string;
|
|
24
|
-
toExponential(places?: number): string;
|
|
25
|
-
toPrecision(sd?: number): string;
|
|
26
|
-
toSignificantDigits(sd?: number): BigNumberValue;
|
|
27
|
-
toBinary(): string;
|
|
28
|
-
toOctal(): string;
|
|
29
|
-
toHexadecimal(): string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Convert a BigNumber to a formatted string representation.
|
|
33
|
-
*
|
|
34
|
-
* Syntax:
|
|
35
|
-
*
|
|
36
|
-
* format(value)
|
|
37
|
-
* format(value, options)
|
|
38
|
-
* format(value, precision)
|
|
39
|
-
* format(value, fn)
|
|
40
|
-
*
|
|
41
|
-
* Where:
|
|
42
|
-
*
|
|
43
|
-
* {number} value The value to be formatted
|
|
44
|
-
* {Object} options An object with formatting options. Available options:
|
|
45
|
-
* {string} notation
|
|
46
|
-
* Number notation. Choose from:
|
|
47
|
-
* 'fixed' Always use regular number notation.
|
|
48
|
-
* For example '123.40' and '14000000'
|
|
49
|
-
* 'exponential' Always use exponential notation.
|
|
50
|
-
* For example '1.234e+2' and '1.4e+7'
|
|
51
|
-
* 'auto' (default) Regular number notation for numbers
|
|
52
|
-
* having an absolute value between
|
|
53
|
-
* `lower` and `upper` bounds, and uses
|
|
54
|
-
* exponential notation elsewhere.
|
|
55
|
-
* Lower bound is included, upper bound
|
|
56
|
-
* is excluded.
|
|
57
|
-
* For example '123.4' and '1.4e7'.
|
|
58
|
-
* 'bin', 'oct, or
|
|
59
|
-
* 'hex' Format the number using binary, octal,
|
|
60
|
-
* or hexadecimal notation.
|
|
61
|
-
* For example '0b1101' and '0x10fe'.
|
|
62
|
-
* {number} wordSize The word size in bits to use for formatting
|
|
63
|
-
* in binary, octal, or hexadecimal notation.
|
|
64
|
-
* To be used only with 'bin', 'oct', or 'hex'
|
|
65
|
-
* values for 'notation' option. When this option
|
|
66
|
-
* is defined the value is formatted as a signed
|
|
67
|
-
* twos complement integer of the given word size
|
|
68
|
-
* and the size suffix is appended to the output.
|
|
69
|
-
* For example
|
|
70
|
-
* format(-1, {notation: 'hex', wordSize: 8}) === '0xffi8'.
|
|
71
|
-
* Default value is undefined.
|
|
72
|
-
* {number} precision A number between 0 and 16 to round
|
|
73
|
-
* the digits of the number.
|
|
74
|
-
* In case of notations 'exponential',
|
|
75
|
-
* 'engineering', and 'auto',
|
|
76
|
-
* `precision` defines the total
|
|
77
|
-
* number of significant digits returned.
|
|
78
|
-
* In case of notation 'fixed',
|
|
79
|
-
* `precision` defines the number of
|
|
80
|
-
* significant digits after the decimal
|
|
81
|
-
* point.
|
|
82
|
-
* `precision` is undefined by default.
|
|
83
|
-
* {number} lowerExp Exponent determining the lower boundary
|
|
84
|
-
* for formatting a value with an exponent
|
|
85
|
-
* when `notation='auto`.
|
|
86
|
-
* Default value is `-3`.
|
|
87
|
-
* {number} upperExp Exponent determining the upper boundary
|
|
88
|
-
* for formatting a value with an exponent
|
|
89
|
-
* when `notation='auto`.
|
|
90
|
-
* Default value is `5`.
|
|
91
|
-
* {Function} fn A custom formatting function. Can be used to override the
|
|
92
|
-
* built-in notations. Function `fn` is called with `value` as
|
|
93
|
-
* parameter and must return a string. Is useful for example to
|
|
94
|
-
* format all values inside a matrix in a particular way.
|
|
95
|
-
*
|
|
96
|
-
* Examples:
|
|
97
|
-
*
|
|
98
|
-
* format(6.4) // '6.4'
|
|
99
|
-
* format(1240000) // '1.24e6'
|
|
100
|
-
* format(1/3) // '0.3333333333333333'
|
|
101
|
-
* format(1/3, 3) // '0.333'
|
|
102
|
-
* format(21385, 2) // '21000'
|
|
103
|
-
* format(12e8, {notation: 'fixed'}) // returns '1200000000'
|
|
104
|
-
* format(2.3, {notation: 'fixed', precision: 4}) // returns '2.3000'
|
|
105
|
-
* format(52.8, {notation: 'exponential'}) // returns '5.28e+1'
|
|
106
|
-
* format(12400, {notation: 'engineering'}) // returns '12.400e+3'
|
|
107
|
-
*
|
|
108
|
-
* @param {BigNumber} value
|
|
109
|
-
* @param {Object | Function | number | BigNumber} [options]
|
|
110
|
-
* @return {string} str The formatted value
|
|
111
|
-
*/
|
|
112
|
-
export declare function format(value: unknown, options?: unknown): string;
|
|
113
|
-
/**
|
|
114
|
-
* Format a BigNumber in engineering notation. Like '1.23e+6', '2.3e+0', '3.500e-3'
|
|
115
|
-
* @param {BigNumber} value
|
|
116
|
-
* @param {number} [precision] Optional number of significant figures to return.
|
|
117
|
-
*/
|
|
118
|
-
export declare function toEngineering(value: BigNumberValue, precision?: number): string;
|
|
119
|
-
/**
|
|
120
|
-
* Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3'
|
|
121
|
-
* @param {BigNumber} value
|
|
122
|
-
* @param {number} [precision] Number of digits in formatted output.
|
|
123
|
-
* If not provided, the maximum available digits
|
|
124
|
-
* is used.
|
|
125
|
-
* @returns {string} str
|
|
126
|
-
*/
|
|
127
|
-
export declare function toExponential(value: BigNumberValue, precision?: number): string;
|
|
128
|
-
/**
|
|
129
|
-
* Format a number with fixed notation.
|
|
130
|
-
* @param {BigNumber} value
|
|
131
|
-
* @param {number} [precision=undefined] Optional number of decimals after the
|
|
132
|
-
* decimal point. Undefined by default.
|
|
133
|
-
*/
|
|
134
|
-
export declare function toFixed(value: BigNumberValue, precision?: number): string;
|
|
135
|
-
export {};
|
|
136
|
-
//# sourceMappingURL=formatter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../../src/utils/bignumber/formatter.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,UAAU,cAAc;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,cAAc,CAAC;IAC5D,QAAQ,IAAI,OAAO,CAAC;IACpB,KAAK,IAAI,OAAO,CAAC;IACjB,MAAM,IAAI,OAAO,CAAC;IAClB,SAAS,IAAI,OAAO,CAAC;IACrB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC;IAC5C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC;IACrD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC;IAClD,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,cAAc,CAAC;IACpD,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,cAAc,CAAC;IACpD,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,cAAc,CAAC;IACpD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,cAAc,CAAC;IAClD,QAAQ,IAAI,MAAM,CAAC;IACnB,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,mBAAmB,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;IACjD,QAAQ,IAAI,MAAM,CAAC;IACnB,OAAO,IAAI,MAAM,CAAC;IAClB,aAAa,IAAI,MAAM,CAAC;CACzB;AA2CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CA0EhE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAe/E;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAM/E;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzE"}
|