@danielsimonjr/mathts-core 0.15.0 → 0.15.1
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/array.d.ts +71 -59
- package/dist/array.d.ts.map +1 -1
- package/dist/bignumber-formatter.d.ts +8 -8
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/error/DimensionError.d.ts +2 -0
- package/dist/error/DimensionError.d.ts.map +1 -1
- package/dist/error/IndexError.d.ts +8 -0
- package/dist/error/IndexError.d.ts.map +1 -1
- package/dist/factory.d.ts +10 -0
- package/dist/factory.d.ts.map +1 -1
- package/dist/index.js +15 -6
- package/dist/internal.js +36 -6
- package/dist/is.d.ts +156 -2
- package/dist/is.d.ts.map +1 -1
- package/dist/map.d.ts +40 -6
- package/dist/map.d.ts.map +1 -1
- package/dist/object.d.ts +26 -26
- package/dist/shared.d.ts +2 -2
- package/dist/string.d.ts +6 -6
- package/dist/typed/type-bridge.d.ts +7 -0
- package/dist/typed/type-bridge.d.ts.map +1 -1
- package/dist/types/bignumber.d.ts +3 -0
- package/dist/types/bignumber.d.ts.map +1 -1
- package/dist/types/dual.d.ts +3 -0
- package/dist/types/dual.d.ts.map +1 -1
- package/dist/types/matrix/Range.d.ts +22 -22
- package/dist/types/matrix/Range.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/array.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { Index, Matrix } from './is.js';
|
|
2
|
+
/**
|
|
3
|
+
* A value of type T, or an array of such values nested to any depth.
|
|
4
|
+
*/
|
|
2
5
|
export type NestedArray<T> = T | NestedArray<T>[];
|
|
6
|
+
/**
|
|
7
|
+
* A value paired with a numeric identifier.
|
|
8
|
+
*
|
|
9
|
+
* `identify` sets `identifier` to the count of equal values that come
|
|
10
|
+
* directly before this value in the sorted input. The first value of each run has identifier 0.
|
|
11
|
+
*/
|
|
3
12
|
export interface IdentifiedValue<T> {
|
|
4
13
|
value: T;
|
|
5
14
|
identifier: number;
|
|
@@ -8,42 +17,42 @@ export interface IdentifiedValue<T> {
|
|
|
8
17
|
* Calculate the size of a multi dimensional array.
|
|
9
18
|
* This function checks the size of the first entry, it does not validate
|
|
10
19
|
* whether all dimensions match. (use function `validate` for that)
|
|
11
|
-
* @param
|
|
20
|
+
* @param x
|
|
12
21
|
* @return {number[]} size
|
|
13
22
|
*/
|
|
14
23
|
export declare function arraySize<T>(x: NestedArray<T>): number[];
|
|
15
24
|
/**
|
|
16
25
|
* Validate whether each element in a multi dimensional array has
|
|
17
26
|
* a size corresponding to the provided size array.
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
27
|
+
* @param array - Array to be validated
|
|
28
|
+
* @param size - Array with the size of each dimension
|
|
20
29
|
* @throws DimensionError
|
|
21
30
|
*/
|
|
22
31
|
export declare function validate<T>(array: NestedArray<T>, size: number[]): void;
|
|
23
32
|
/**
|
|
24
33
|
* Validate whether the source of the index matches the size of the Array
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
34
|
+
* @param value - Array to be validated
|
|
35
|
+
* @param index - Index with the source information to validate
|
|
27
36
|
* @throws DimensionError
|
|
28
37
|
*/
|
|
29
38
|
export declare function validateIndexSourceSize(value: unknown[] | Matrix, index: Index): void;
|
|
30
39
|
/**
|
|
31
40
|
* Test whether index is an integer number with index >= 0 and index < length
|
|
32
41
|
* when length is provided
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
42
|
+
* @param index - Zero-based index
|
|
43
|
+
* @param length - Optional. Length of the array
|
|
35
44
|
*/
|
|
36
45
|
export declare function validateIndex(index: number | undefined, length?: number): void;
|
|
37
46
|
/**
|
|
38
47
|
* Test if an index has empty values
|
|
39
|
-
* @param
|
|
48
|
+
* @param index - Zero-based index
|
|
40
49
|
*/
|
|
41
50
|
export declare function isEmptyIndex(index: Index): boolean;
|
|
42
51
|
/**
|
|
43
52
|
* Resize a multi dimensional array. The resized array is returned.
|
|
44
|
-
* @param
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
53
|
+
* @param array - Array to be resized
|
|
54
|
+
* @param size - Array with the size of each dimension
|
|
55
|
+
* @param defaultValue - Optional. Default is 0. Value to be filled in new entries,
|
|
47
56
|
* zero by default. Specify for example `null`,
|
|
48
57
|
* to clearly see entries that are not explicitly
|
|
49
58
|
* set.
|
|
@@ -52,8 +61,8 @@ export declare function isEmptyIndex(index: Index): boolean;
|
|
|
52
61
|
export declare function resize<T = unknown>(array: T | T[] | NestedArray<T>, size: number[], defaultValue?: T): NestedArray<T>;
|
|
53
62
|
/**
|
|
54
63
|
* Re-shape a multi dimensional array to fit the specified dimensions
|
|
55
|
-
* @param
|
|
56
|
-
* @param
|
|
64
|
+
* @param array - Array to be reshaped
|
|
65
|
+
* @param sizes - List of sizes for each dimension
|
|
57
66
|
* @returns {Array} Array whose data has been formatted to fit the
|
|
58
67
|
* specified dimensions
|
|
59
68
|
*
|
|
@@ -63,16 +72,16 @@ export declare function resize<T = unknown>(array: T | T[] | NestedArray<T>, siz
|
|
|
63
72
|
export declare function reshape<T = unknown>(array: NestedArray<T>, sizes: number[]): NestedArray<T>;
|
|
64
73
|
/**
|
|
65
74
|
* Replaces the wildcard -1 in the sizes array.
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
75
|
+
* @param sizes - List of sizes for each dimension. At most one wildcard.
|
|
76
|
+
* @param currentLength - Number of elements in the array.
|
|
68
77
|
* @throws {Error} If more than one wildcard or unable to replace it.
|
|
69
78
|
* @returns {number[]} The sizes array with wildcard replaced.
|
|
70
79
|
*/
|
|
71
80
|
export declare function processSizesWildcard(sizes: number[], currentLength: number): number[];
|
|
72
81
|
/**
|
|
73
82
|
* Squeeze a multi dimensional array
|
|
74
|
-
* @param
|
|
75
|
-
* @param
|
|
83
|
+
* @param array
|
|
84
|
+
* @param size - Optional.
|
|
76
85
|
* @returns {Array} returns the array itself
|
|
77
86
|
*/
|
|
78
87
|
export declare function squeeze<T>(array: NestedArray<T>, size?: number[]): T | NestedArray<T>;
|
|
@@ -81,10 +90,10 @@ export declare function squeeze<T>(array: NestedArray<T>, size?: number[]): T |
|
|
|
81
90
|
*
|
|
82
91
|
* Parameter `size` will be mutated to match the new, unsqueezed matrix size.
|
|
83
92
|
*
|
|
84
|
-
* @param
|
|
85
|
-
* @param
|
|
86
|
-
* @param
|
|
87
|
-
* @param
|
|
93
|
+
* @param array
|
|
94
|
+
* @param dims - Desired number of dimensions of the array
|
|
95
|
+
* @param outer - Optional. Number of outer dimensions to be added
|
|
96
|
+
* @param size - Optional. Current size of array.
|
|
88
97
|
* @returns {Array} returns the array itself
|
|
89
98
|
* @private
|
|
90
99
|
*/
|
|
@@ -92,52 +101,52 @@ export declare function unsqueeze<T>(array: NestedArray<T>, dims: number, outer?
|
|
|
92
101
|
/**
|
|
93
102
|
* Flatten a multi dimensional array, put all elements in a one dimensional
|
|
94
103
|
* array
|
|
95
|
-
* @param
|
|
96
|
-
* @param
|
|
104
|
+
* @param array - A multi dimensional array
|
|
105
|
+
* @param isRectangular - Optional. If the array is rectangular (not jagged)
|
|
97
106
|
* @return {Array} The flattened array (1 dimensional)
|
|
98
107
|
*/
|
|
99
108
|
export declare function flatten<T>(array: NestedArray<T>, isRectangular?: boolean): T[];
|
|
100
109
|
/**
|
|
101
110
|
* A safe map
|
|
102
|
-
* @param
|
|
103
|
-
* @param
|
|
111
|
+
* @param array
|
|
112
|
+
* @param callback
|
|
104
113
|
*/
|
|
105
114
|
export declare function map<T, U>(array: T[], callback: (value: T, index: number, array: T[]) => U): U[];
|
|
106
115
|
/**
|
|
107
116
|
* A safe forEach
|
|
108
|
-
* @param
|
|
109
|
-
* @param
|
|
117
|
+
* @param array
|
|
118
|
+
* @param callback
|
|
110
119
|
*/
|
|
111
120
|
export declare function forEach<T>(array: T[], callback: (value: T, index: number, array: T[]) => void): void;
|
|
112
121
|
/**
|
|
113
122
|
* A safe filter
|
|
114
|
-
* @param
|
|
115
|
-
* @param
|
|
123
|
+
* @param array
|
|
124
|
+
* @param callback
|
|
116
125
|
*/
|
|
117
126
|
export declare function filter<T>(array: T[], callback: (value: T, index: number, array: T[]) => boolean): T[];
|
|
118
127
|
/**
|
|
119
128
|
* Filter values in an array given a regular expression
|
|
120
|
-
* @param
|
|
121
|
-
* @param
|
|
129
|
+
* @param array
|
|
130
|
+
* @param regexp
|
|
122
131
|
* @return {Array} Returns the filtered array
|
|
123
132
|
* @private
|
|
124
133
|
*/
|
|
125
134
|
export declare function filterRegExp(array: string[], regexp: RegExp): string[];
|
|
126
135
|
/**
|
|
127
136
|
* A safe join
|
|
128
|
-
* @param
|
|
129
|
-
* @param
|
|
137
|
+
* @param array
|
|
138
|
+
* @param separator
|
|
130
139
|
*/
|
|
131
140
|
export declare function join<T>(array: T[], separator: string): string;
|
|
132
141
|
/**
|
|
133
142
|
* Assign a numeric identifier to every element of a sorted array
|
|
134
|
-
* @param
|
|
143
|
+
* @param a - An array
|
|
135
144
|
* @return {Array} An array of objects containing the original value and its identifier
|
|
136
145
|
*/
|
|
137
146
|
export declare function identify<T>(a: T[]): IdentifiedValue<T>[];
|
|
138
147
|
/**
|
|
139
148
|
* Remove the numeric identifier from the elements
|
|
140
|
-
* @param
|
|
149
|
+
* @param a - An array
|
|
141
150
|
* @return {array} An array of values without identifiers
|
|
142
151
|
*/
|
|
143
152
|
export declare function generalize<T>(a: IdentifiedValue<T>[]): T[];
|
|
@@ -146,14 +155,14 @@ export declare function generalize<T>(a: IdentifiedValue<T>[]): T[];
|
|
|
146
155
|
* This is a low level implementation that should only be used by
|
|
147
156
|
* parent Matrix classes such as SparseMatrix or DenseMatrix
|
|
148
157
|
* This method does not validate Array Matrix shape
|
|
149
|
-
* @param
|
|
150
|
-
* @param
|
|
158
|
+
* @param array
|
|
159
|
+
* @param typeOf - Callback function to use to determine the type of a value
|
|
151
160
|
* @return {string}
|
|
152
161
|
*/
|
|
153
162
|
export declare function getArrayDataType(array: unknown[], typeOf: (value: unknown) => string): string | undefined;
|
|
154
163
|
/**
|
|
155
164
|
* Return the last item from an array
|
|
156
|
-
* @param
|
|
165
|
+
* @param array
|
|
157
166
|
* @returns {*}
|
|
158
167
|
*/
|
|
159
168
|
export declare function last<T>(array: T[]): T;
|
|
@@ -164,55 +173,58 @@ export declare function last<T>(array: T[]): T;
|
|
|
164
173
|
* this; `functions/src/utils/array.ts` never defined it, and it was dead code
|
|
165
174
|
* even in expression (unused outside its own definition). Re-exported from
|
|
166
175
|
* expression's shim only — see the module header.
|
|
167
|
-
* @param
|
|
176
|
+
* @param array
|
|
168
177
|
* @returns {Array}
|
|
169
178
|
*/
|
|
170
179
|
export declare function initial<T>(array: T[]): T[];
|
|
171
180
|
/**
|
|
172
181
|
* Concatenates many arrays in the specified direction
|
|
173
|
-
*
|
|
174
|
-
*
|
|
182
|
+
*
|
|
183
|
+
* With one array, the function returns that array without a copy.
|
|
184
|
+
*
|
|
185
|
+
* @param args - All the arrays to concatenate, then the dimension on which to concatenate (zero-based) as the last element
|
|
175
186
|
* @returns {Array}
|
|
187
|
+
* @throws Error when `args` contains no array.
|
|
176
188
|
*/
|
|
177
189
|
export declare function concat<T>(...args: [...NestedArray<T>[], number]): NestedArray<T>[];
|
|
178
190
|
/**
|
|
179
191
|
* Receives two or more sizes and gets the broadcasted size for both.
|
|
180
|
-
* @param
|
|
192
|
+
* @param sizes - Sizes to broadcast together
|
|
181
193
|
* @returns {number[]} The broadcasted size
|
|
182
194
|
*/
|
|
183
195
|
export declare function broadcastSizes(...sizes: number[][]): number[];
|
|
184
196
|
/**
|
|
185
197
|
* Checks if it's possible to broadcast a size to another size
|
|
186
|
-
* @param
|
|
187
|
-
* @param
|
|
198
|
+
* @param size - The size of the array to check
|
|
199
|
+
* @param toSize - The size of the array to validate if it can be broadcasted to
|
|
188
200
|
*/
|
|
189
201
|
export declare function checkBroadcastingRules(size: number[], toSize: number[]): void;
|
|
190
202
|
/**
|
|
191
203
|
* Broadcasts a single array to a certain size
|
|
192
|
-
* @param
|
|
193
|
-
* @param
|
|
204
|
+
* @param array - Array to be broadcasted
|
|
205
|
+
* @param toSize - Size to broadcast the array
|
|
194
206
|
* @returns {Array} The broadcasted array
|
|
195
207
|
*/
|
|
196
208
|
export declare function broadcastTo<T>(array: NestedArray<T>, toSize: number[]): NestedArray<T>;
|
|
197
209
|
/**
|
|
198
210
|
* Broadcasts arrays and returns the broadcasted arrays in an array
|
|
199
|
-
* @param
|
|
211
|
+
* @param arrays
|
|
200
212
|
* @returns {Array[]} The broadcasted arrays
|
|
201
213
|
*/
|
|
202
214
|
export declare function broadcastArrays<T>(...arrays: NestedArray<T>[]): NestedArray<T>[];
|
|
203
215
|
/**
|
|
204
216
|
* Stretches a matrix up to a certain size in a certain dimension
|
|
205
|
-
* @param
|
|
206
|
-
* @param
|
|
207
|
-
* @param
|
|
217
|
+
* @param arrayToStretch
|
|
218
|
+
* @param sizeToStretch
|
|
219
|
+
* @param dimToStretch
|
|
208
220
|
* @returns {Array} The stretched array
|
|
209
221
|
*/
|
|
210
222
|
export declare function stretch<T>(arrayToStretch: NestedArray<T>, sizeToStretch: number, dimToStretch: number): NestedArray<T>;
|
|
211
223
|
/**
|
|
212
224
|
* Retrieves a single element from an array given an index.
|
|
213
225
|
*
|
|
214
|
-
* @param
|
|
215
|
-
* @param
|
|
226
|
+
* @param array - The array from which to retrieve the value.
|
|
227
|
+
* @param index - An array of indices specifying the position of the desired element in each dimension.
|
|
216
228
|
* @returns {*} - The value at the specified position in the array.
|
|
217
229
|
*
|
|
218
230
|
* @example
|
|
@@ -224,29 +236,29 @@ export declare function get<T>(array: NestedArray<T>, index: number[]): T;
|
|
|
224
236
|
/**
|
|
225
237
|
* Recursively maps over each element of nested array using a provided callback function.
|
|
226
238
|
*
|
|
227
|
-
* @param
|
|
228
|
-
* @param
|
|
239
|
+
* @param array - The array to be mapped.
|
|
240
|
+
* @param callback - The function to execute on each element, taking three arguments:
|
|
229
241
|
* - `value` (any): The current element being processed in the array.
|
|
230
242
|
* - `index` (Array<number>): The index of the current element being processed in the array.
|
|
231
243
|
* - `array` (Array): The array `deepMap` was called upon.
|
|
232
|
-
* @param
|
|
244
|
+
* @param skipIndex - Optional. Default is false. If true, the callback function is called with only the value.
|
|
233
245
|
* @returns {Array} A new array with each element being the result of the callback function.
|
|
234
246
|
*/
|
|
235
247
|
export declare function deepMap<T, U>(array: NestedArray<T>, callback: ((value: T, index: number[], array: NestedArray<T>) => U) | ((value: T) => U), skipIndex?: boolean): NestedArray<U>;
|
|
236
248
|
/**
|
|
237
249
|
* Recursively iterates over each element in a multi-dimensional array and applies a callback function.
|
|
238
250
|
*
|
|
239
|
-
* @param
|
|
240
|
-
* @param
|
|
251
|
+
* @param array - The multi-dimensional array to iterate over.
|
|
252
|
+
* @param callback - The function to execute for each element. It receives three arguments:
|
|
241
253
|
* - {any} value: The current element being processed in the array.
|
|
242
254
|
* - {Array<number>} index: The index of the current element in each dimension.
|
|
243
255
|
* - {Array} array: The original array being processed.
|
|
244
|
-
* @param
|
|
256
|
+
* @param skipIndex - Optional. Default is false. If true, the callback function is called with only the value.
|
|
245
257
|
*/
|
|
246
258
|
export declare function deepForEach<T>(array: NestedArray<T>, callback: ((value: T, index: number[], array: NestedArray<T>) => void) | ((value: T) => void), skipIndex?: boolean): void;
|
|
247
259
|
/**
|
|
248
260
|
* Deep clones a multidimensional array
|
|
249
|
-
* @param
|
|
261
|
+
* @param array
|
|
250
262
|
* @returns {Array} cloned array
|
|
251
263
|
*/
|
|
252
264
|
export declare function clone<T>(array: T[]): T[];
|
package/dist/array.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../src/array.ts"],"names":[],"mappings":"AAsBA,OAAO,EAA4C,KAAK,EAAE,MAAM,EAAkB,MAAM,SAAS,CAAC;AAOlG,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;AAGlD,MAAM,W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GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,EACvB,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC,EAC9B,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,GACnB,WAAW,CAAC,CAAC,CAAC,CAEhB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,CAYhE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAC1B,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EACrB,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,EACvF,SAAS,GAAE,OAAe,GACzB,WAAW,CAAC,CAAC,CAAC,CA0ChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EACrB,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,EAC7F,SAAS,GAAE,OAAe,GACzB,IAAI,CAsCN;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAExC"}
|
|
@@ -105,21 +105,21 @@ export interface BigNumberValue {
|
|
|
105
105
|
* format(52.8, {notation: 'exponential'}) // returns '5.28e+1'
|
|
106
106
|
* format(12400, {notation: 'engineering'}) // returns '12.400e+3'
|
|
107
107
|
*
|
|
108
|
-
* @param
|
|
109
|
-
* @param
|
|
108
|
+
* @param value
|
|
109
|
+
* @param options - Optional.
|
|
110
110
|
* @return {string} str The formatted value
|
|
111
111
|
*/
|
|
112
112
|
export declare function format(value: unknown, options?: unknown): string;
|
|
113
113
|
/**
|
|
114
114
|
* Format a BigNumber in engineering notation. Like '1.23e+6', '2.3e+0', '3.500e-3'
|
|
115
|
-
* @param
|
|
116
|
-
* @param
|
|
115
|
+
* @param value
|
|
116
|
+
* @param precision - Optional number of significant figures to return.
|
|
117
117
|
*/
|
|
118
118
|
export declare function toEngineering(value: BigNumberValue, precision?: number): string;
|
|
119
119
|
/**
|
|
120
120
|
* Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3'
|
|
121
|
-
* @param
|
|
122
|
-
* @param
|
|
121
|
+
* @param value
|
|
122
|
+
* @param precision - Optional. Number of digits in formatted output.
|
|
123
123
|
* If not provided, the maximum available digits
|
|
124
124
|
* is used.
|
|
125
125
|
* @returns {string} str
|
|
@@ -127,8 +127,8 @@ export declare function toEngineering(value: BigNumberValue, precision?: number)
|
|
|
127
127
|
export declare function toExponential(value: BigNumberValue, precision?: number): string;
|
|
128
128
|
/**
|
|
129
129
|
* Format a number with fixed notation.
|
|
130
|
-
* @param
|
|
131
|
-
* @param
|
|
130
|
+
* @param value
|
|
131
|
+
* @param precision - Optional number of decimals after the
|
|
132
132
|
* decimal point. Undefined by default.
|
|
133
133
|
*/
|
|
134
134
|
export declare function toFixed(value: BigNumberValue, precision?: number): string;
|
package/dist/config.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ export interface ConfigOptions {
|
|
|
12
12
|
randomSeed: string | null;
|
|
13
13
|
legacySubset: boolean;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Alias of `ConfigOptions`, kept for backward compatibility.
|
|
17
|
+
*/
|
|
15
18
|
export type MathJsConfig = ConfigOptions;
|
|
16
19
|
export declare const DEFAULT_CONFIG: ConfigOptions;
|
|
17
20
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAG5B,MAAM,EAAE,MAAM,CAAC;IAIf,MAAM,EAAE,MAAM,CAAC;IAGf,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC;IAG3B,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;IAIvD,cAAc,EAAE,QAAQ,GAAG,WAAW,CAAC;IAGvC,SAAS,EAAE,MAAM,CAAC;IAMlB,WAAW,EAAE,OAAO,CAAC;IAIrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAK1B,YAAY,EAAE,OAAO,CAAC;CACvB;AAGD,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC;AAEzC,eAAO,MAAM,cAAc,EAAE,aAoC5B,CAAC"}
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAG5B,MAAM,EAAE,MAAM,CAAC;IAIf,MAAM,EAAE,MAAM,CAAC;IAGf,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC;IAG3B,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;IAIvD,cAAc,EAAE,QAAQ,GAAG,WAAW,CAAC;IAGvC,SAAS,EAAE,MAAM,CAAC;IAMlB,WAAW,EAAE,OAAO,CAAC;IAIrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAK1B,YAAY,EAAE,OAAO,CAAC;CACvB;AAGD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC;AAEzC,eAAO,MAAM,cAAc,EAAE,aAoC5B,CAAC"}
|
|
@@ -17,6 +17,8 @@ export declare class DimensionError extends RangeError {
|
|
|
17
17
|
relation?: string;
|
|
18
18
|
isDimensionError: true;
|
|
19
19
|
/**
|
|
20
|
+
* Create a DimensionError. When `actual` is a string and `expected` is not given, the string is the message.
|
|
21
|
+
*
|
|
20
22
|
* @param actual - The actual size or custom error message
|
|
21
23
|
* @param expected - The expected size (optional if actual is a custom message)
|
|
22
24
|
* @param relation - Optional relation between actual and expected size: '!=', '<', etc.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DimensionError.d.ts","sourceRoot":"","sources":["../../src/error/DimensionError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAC5C,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,OAAiB;IAEjC
|
|
1
|
+
{"version":3,"file":"DimensionError.d.ts","sourceRoot":"","sources":["../../src/error/DimensionError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAC5C,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,OAAiB;IAEjC;;;;;;OAMG;IACH,YAAY,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,EAwC9F;CACF"}
|
|
@@ -29,5 +29,13 @@ export declare class IndexError extends RangeError {
|
|
|
29
29
|
*/
|
|
30
30
|
constructor(index: number, min?: number, max?: number);
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Create an IndexError without the `new` operator.
|
|
34
|
+
*
|
|
35
|
+
* @param index - The actual index.
|
|
36
|
+
* @param min - The minimum index (included). When `max` is not given, this value is the maximum and the minimum is 0.
|
|
37
|
+
* @param max - The maximum index (excluded).
|
|
38
|
+
* @returns A new IndexError.
|
|
39
|
+
*/
|
|
32
40
|
export declare function createIndexError(index: number, min?: number, max?: number): IndexError;
|
|
33
41
|
//# sourceMappingURL=IndexError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndexError.d.ts","sourceRoot":"","sources":["../../src/error/IndexError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,qBAAa,UAAW,SAAQ,UAAU;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,YAAY,OAAiB;IAE7B;;;;;;;;;;OAUG;IACH,YAAY,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAqCpD;CACF;AAID,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU,CAEtF"}
|
|
1
|
+
{"version":3,"file":"IndexError.d.ts","sourceRoot":"","sources":["../../src/error/IndexError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,qBAAa,UAAW,SAAQ,UAAU;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,YAAY,OAAiB;IAE7B;;;;;;;;;;OAUG;IACH,YAAY,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAqCpD;CACF;AAID;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU,CAEtF"}
|
package/dist/factory.d.ts
CHANGED
|
@@ -78,6 +78,16 @@ export declare function factory<TDeps extends Record<string, unknown> = Record<s
|
|
|
78
78
|
* @returns Returns a new array with the sorted factories
|
|
79
79
|
*/
|
|
80
80
|
export declare function sortFactories(factories: Array<FactoryFunction | LegacyFactory>): Array<FactoryFunction | LegacyFactory>;
|
|
81
|
+
/**
|
|
82
|
+
* Run the factory functions in dependency order on one scope object.
|
|
83
|
+
*
|
|
84
|
+
* The function sorts the factories with `sortFactories`. It then calls each
|
|
85
|
+
* non-legacy factory with the scope. It does not call legacy factories.
|
|
86
|
+
*
|
|
87
|
+
* @param factories - The factory functions and legacy factories.
|
|
88
|
+
* @param scope - The object that the factories receive. The function changes this object.
|
|
89
|
+
* @returns The same scope object.
|
|
90
|
+
*/
|
|
81
91
|
export declare function create(factories: Array<FactoryFunction | LegacyFactory>, scope?: Record<string, unknown>): Record<string, unknown>;
|
|
82
92
|
/**
|
|
83
93
|
* Test whether an object is a factory. This is the case when it has
|
package/dist/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,OAAO,GAAG,OAAO;IAChD,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;IAC1C,SAAS,EAAE,IAAI,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,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KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,IAAI,CAeN;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO,CAIxE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM,CAExE"}
|
package/dist/index.js
CHANGED
|
@@ -90,6 +90,15 @@ var createRangeClass = /* @__PURE__ */ factory(
|
|
|
90
90
|
_cacheStart;
|
|
91
91
|
_cacheEnd;
|
|
92
92
|
_cacheStep;
|
|
93
|
+
/**
|
|
94
|
+
* Create a range from start to end with a step.
|
|
95
|
+
*
|
|
96
|
+
* @param start - Included lower bound. Default is 0.
|
|
97
|
+
* @param end - Excluded upper bound. Default is 0.
|
|
98
|
+
* @param step - Optional step size. Default is 1.
|
|
99
|
+
* @throws TypeError when start, end or step is not a number, bigint or BigNumber.
|
|
100
|
+
* @throws Error when step is zero.
|
|
101
|
+
*/
|
|
93
102
|
constructor(start, end, step) {
|
|
94
103
|
if (!(this instanceof Range2)) {
|
|
95
104
|
throw new SyntaxError("Constructor must be called with the new operator");
|
|
@@ -140,7 +149,7 @@ var createRangeClass = /* @__PURE__ */ factory(
|
|
|
140
149
|
* If the string does not contain a valid range, null is returned.
|
|
141
150
|
* For example str='0:2:11'.
|
|
142
151
|
* @memberof Range
|
|
143
|
-
* @param
|
|
152
|
+
* @param str
|
|
144
153
|
* @return {Range | null} range
|
|
145
154
|
*/
|
|
146
155
|
static parse(str) {
|
|
@@ -232,7 +241,7 @@ var createRangeClass = /* @__PURE__ */ factory(
|
|
|
232
241
|
/**
|
|
233
242
|
* Execute a callback function for each value in the range.
|
|
234
243
|
* @memberof Range
|
|
235
|
-
* @param
|
|
244
|
+
* @param callback - The callback method is invoked with three
|
|
236
245
|
* parameters: the value of the element, the index
|
|
237
246
|
* of the element, and the Range being traversed.
|
|
238
247
|
*/
|
|
@@ -259,7 +268,7 @@ var createRangeClass = /* @__PURE__ */ factory(
|
|
|
259
268
|
* Execute a callback function for each value in the Range, and return the
|
|
260
269
|
* results as an array
|
|
261
270
|
* @memberof Range
|
|
262
|
-
* @param
|
|
271
|
+
* @param callback - The callback method is invoked with three
|
|
263
272
|
* parameters: the value of the element, the index
|
|
264
273
|
* of the element, and the Matrix being traversed.
|
|
265
274
|
* @returns {Array} array
|
|
@@ -302,7 +311,7 @@ var createRangeClass = /* @__PURE__ */ factory(
|
|
|
302
311
|
* Get a string representation of the range, with optional formatting options.
|
|
303
312
|
* Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'
|
|
304
313
|
* @memberof Range
|
|
305
|
-
* @param
|
|
314
|
+
* @param options - Optional. Formatting options. See
|
|
306
315
|
* lib/utils/number:format for a
|
|
307
316
|
* description of the available
|
|
308
317
|
* options.
|
|
@@ -341,7 +350,7 @@ var createRangeClass = /* @__PURE__ */ factory(
|
|
|
341
350
|
/**
|
|
342
351
|
* Instantiate a Range from a JSON object
|
|
343
352
|
* @memberof Range
|
|
344
|
-
* @param
|
|
353
|
+
* @param json - A JSON object structured as:
|
|
345
354
|
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
346
355
|
* @return {Range}
|
|
347
356
|
*/
|
|
@@ -1377,7 +1386,7 @@ function neumaierCumsum(xs, out) {
|
|
|
1377
1386
|
}
|
|
1378
1387
|
|
|
1379
1388
|
// src/index.ts
|
|
1380
|
-
var VERSION = "0.15.
|
|
1389
|
+
var VERSION = "0.15.1";
|
|
1381
1390
|
export {
|
|
1382
1391
|
ALL_UNITS,
|
|
1383
1392
|
BASE_UNITS,
|
package/dist/internal.js
CHANGED
|
@@ -87,6 +87,8 @@ var DimensionError = class _DimensionError extends RangeError {
|
|
|
87
87
|
relation;
|
|
88
88
|
isDimensionError = true;
|
|
89
89
|
/**
|
|
90
|
+
* Create a DimensionError. When `actual` is a string and `expected` is not given, the string is the message.
|
|
91
|
+
*
|
|
90
92
|
* @param actual - The actual size or custom error message
|
|
91
93
|
* @param expected - The expected size (optional if actual is a custom message)
|
|
92
94
|
* @param relation - Optional relation between actual and expected size: '!=', '<', etc.
|
|
@@ -1196,7 +1198,6 @@ var ObjectWrappingMap = class {
|
|
|
1196
1198
|
[Symbol.iterator]() {
|
|
1197
1199
|
return this.entries();
|
|
1198
1200
|
}
|
|
1199
|
-
// @ts-expect-error: Implementation is compatible but TS can't infer it
|
|
1200
1201
|
keys() {
|
|
1201
1202
|
return Object.keys(this.wrappedObject).filter((key) => this.has(key)).values();
|
|
1202
1203
|
}
|
|
@@ -1210,11 +1211,25 @@ var ObjectWrappingMap = class {
|
|
|
1210
1211
|
has(key) {
|
|
1211
1212
|
return isSafeProperty(this.wrappedObject, key) && key in this.wrappedObject;
|
|
1212
1213
|
}
|
|
1213
|
-
|
|
1214
|
+
/**
|
|
1215
|
+
* Return the value for `key`; when the key is absent, set it to `defaultValue` first.
|
|
1216
|
+
* Declared because the ESNext `Map` (TC39 upsert) has it, and `implements Map` requires it.
|
|
1217
|
+
*/
|
|
1218
|
+
getOrInsert(key, defaultValue) {
|
|
1219
|
+
if (!this.has(key)) this.set(key, defaultValue);
|
|
1220
|
+
return this.get(key);
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Return the value for `key`; when the key is absent, set it to `callback(key)` first.
|
|
1224
|
+
* Declared because the ESNext `Map` (TC39 upsert) has it, and `implements Map` requires it.
|
|
1225
|
+
*/
|
|
1226
|
+
getOrInsertComputed(key, callback) {
|
|
1227
|
+
if (!this.has(key)) this.set(key, callback(key));
|
|
1228
|
+
return this.get(key);
|
|
1229
|
+
}
|
|
1214
1230
|
entries() {
|
|
1215
1231
|
return mapIterator(this.keys(), (key) => [key, this.get(key)]);
|
|
1216
1232
|
}
|
|
1217
|
-
// @ts-expect-error: Implementation is compatible but TS can't infer it
|
|
1218
1233
|
*values() {
|
|
1219
1234
|
for (const key of this.keys()) {
|
|
1220
1235
|
yield this.get(key);
|
|
@@ -1247,6 +1262,8 @@ var PartitionedMap = class {
|
|
|
1247
1262
|
bKeys;
|
|
1248
1263
|
[Symbol.toStringTag] = "PartitionedMap";
|
|
1249
1264
|
/**
|
|
1265
|
+
* Create a PartitionedMap over two maps.
|
|
1266
|
+
*
|
|
1250
1267
|
* @param a - Primary map
|
|
1251
1268
|
* @param b - Secondary map
|
|
1252
1269
|
* @param bKeys - Set of keys that should be read/written to map b
|
|
@@ -1274,17 +1291,30 @@ var PartitionedMap = class {
|
|
|
1274
1291
|
has(key) {
|
|
1275
1292
|
return this.b.has(key) || this.a.has(key);
|
|
1276
1293
|
}
|
|
1277
|
-
|
|
1294
|
+
/**
|
|
1295
|
+
* Return the value for `key`; when the key is absent, set it to `defaultValue` first.
|
|
1296
|
+
* Declared because the ESNext `Map` (TC39 upsert) has it, and `implements Map` requires it.
|
|
1297
|
+
*/
|
|
1298
|
+
getOrInsert(key, defaultValue) {
|
|
1299
|
+
if (!this.has(key)) this.set(key, defaultValue);
|
|
1300
|
+
return this.get(key);
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Return the value for `key`; when the key is absent, set it to `callback(key)` first.
|
|
1304
|
+
* Declared because the ESNext `Map` (TC39 upsert) has it, and `implements Map` requires it.
|
|
1305
|
+
*/
|
|
1306
|
+
getOrInsertComputed(key, callback) {
|
|
1307
|
+
if (!this.has(key)) this.set(key, callback(key));
|
|
1308
|
+
return this.get(key);
|
|
1309
|
+
}
|
|
1278
1310
|
keys() {
|
|
1279
1311
|
return (/* @__PURE__ */ new Set([...this.a.keys(), ...this.b.keys()]))[Symbol.iterator]();
|
|
1280
1312
|
}
|
|
1281
|
-
// @ts-expect-error: Implementation is compatible but TS can't infer it
|
|
1282
1313
|
*values() {
|
|
1283
1314
|
for (const key of this.keys()) {
|
|
1284
1315
|
yield this.get(key);
|
|
1285
1316
|
}
|
|
1286
1317
|
}
|
|
1287
|
-
// @ts-expect-error: Implementation is compatible but TS can't infer it
|
|
1288
1318
|
entries() {
|
|
1289
1319
|
return mapIterator(this.keys(), (key) => [key, this.get(key)]);
|
|
1290
1320
|
}
|