@danielsimonjr/mathts-core 0.14.1 → 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/{chunk-VPK5YTKG.js → chunk-L5MWGOLB.js} +111 -29
- 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 -2585
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -18
- package/dist/internal.d.ts +33 -1344
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +5 -3
- 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 +9 -9
- package/dist/index-B4LIOfHN.d.ts +0 -449
|
@@ -0,0 +1,767 @@
|
|
|
1
|
+
interface BigNumber {
|
|
2
|
+
toNumber(): number;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Callback function for Range forEach operations
|
|
6
|
+
*/
|
|
7
|
+
export type RangeForEachCallback = (value: number, index: number[], range: unknown) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Callback function for Range map operations
|
|
10
|
+
*/
|
|
11
|
+
export type RangeMapCallback<T> = (value: number, index: number[], range: unknown) => T;
|
|
12
|
+
/**
|
|
13
|
+
* Formatting options for Range display
|
|
14
|
+
*/
|
|
15
|
+
export interface RangeFormatOptions {
|
|
16
|
+
precision?: number;
|
|
17
|
+
notation?: 'fixed' | 'exponential' | 'engineering' | 'auto';
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* JSON representation of a Range
|
|
22
|
+
*/
|
|
23
|
+
export interface RangeJSON {
|
|
24
|
+
mathjs: 'Range';
|
|
25
|
+
start: number;
|
|
26
|
+
end: number;
|
|
27
|
+
step: number;
|
|
28
|
+
}
|
|
29
|
+
export declare const createRangeClass: import("../../factory.js").FactoryFunction<{
|
|
30
|
+
new (start?: number | bigint | BigNumber | null, end?: number | bigint | BigNumber | null, step?: number | bigint | BigNumber | null): {
|
|
31
|
+
/**
|
|
32
|
+
* Type identifier
|
|
33
|
+
*/
|
|
34
|
+
readonly type: string;
|
|
35
|
+
/**
|
|
36
|
+
* Range type flag
|
|
37
|
+
*/
|
|
38
|
+
readonly isRange: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Start value of the range (inclusive)
|
|
41
|
+
*/
|
|
42
|
+
start: number;
|
|
43
|
+
/**
|
|
44
|
+
* End value of the range (exclusive)
|
|
45
|
+
*/
|
|
46
|
+
end: number;
|
|
47
|
+
/**
|
|
48
|
+
* Step size for the range
|
|
49
|
+
*/
|
|
50
|
+
step: number;
|
|
51
|
+
/**
|
|
52
|
+
* Cached primitive array representation.
|
|
53
|
+
*
|
|
54
|
+
* @internal Not part of the public API.
|
|
55
|
+
*
|
|
56
|
+
* These four were ES-private (`#cache`) until TypeScript 7. This class is
|
|
57
|
+
* returned from a `factory()` call, so declaration emit describes it as an
|
|
58
|
+
* ANONYMOUS class type -- and TS4094 forbids private or protected members
|
|
59
|
+
* there, because an anonymous type has no name to refer them to. The
|
|
60
|
+
* underscore prefix keeps the "do not touch" signal without the emit
|
|
61
|
+
* failure. Restore `#` if the class is ever hoisted out of the factory.
|
|
62
|
+
*/
|
|
63
|
+
_cache: number[] | null;
|
|
64
|
+
_cacheStart?: number;
|
|
65
|
+
_cacheEnd?: number;
|
|
66
|
+
_cacheStep?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Create a clone of the range
|
|
69
|
+
* @return {Range} clone
|
|
70
|
+
*/
|
|
71
|
+
clone(): /*elided*/ any;
|
|
72
|
+
/**
|
|
73
|
+
* Retrieve the size of the range.
|
|
74
|
+
* Returns an array containing one number, the number of elements in the range.
|
|
75
|
+
* @memberof Range
|
|
76
|
+
* @returns {number[]} size
|
|
77
|
+
*/
|
|
78
|
+
size(): number[];
|
|
79
|
+
/**
|
|
80
|
+
* Calculate the minimum value in the range
|
|
81
|
+
* @memberof Range
|
|
82
|
+
* @return {number | undefined} min
|
|
83
|
+
*/
|
|
84
|
+
min(): number | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Calculate the maximum value in the range
|
|
87
|
+
* @memberof Range
|
|
88
|
+
* @return {number | undefined} max
|
|
89
|
+
*/
|
|
90
|
+
max(): number | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Execute a callback function for each value in the range.
|
|
93
|
+
* @memberof Range
|
|
94
|
+
* @param {function} callback The callback method is invoked with three
|
|
95
|
+
* parameters: the value of the element, the index
|
|
96
|
+
* of the element, and the Range being traversed.
|
|
97
|
+
*/
|
|
98
|
+
forEach(callback: RangeForEachCallback): void;
|
|
99
|
+
/**
|
|
100
|
+
* Execute a callback function for each value in the Range, and return the
|
|
101
|
+
* results as an array
|
|
102
|
+
* @memberof Range
|
|
103
|
+
* @param {function} callback The callback method is invoked with three
|
|
104
|
+
* parameters: the value of the element, the index
|
|
105
|
+
* of the element, and the Matrix being traversed.
|
|
106
|
+
* @returns {Array} array
|
|
107
|
+
*/
|
|
108
|
+
map<T>(callback: RangeMapCallback<T>): T[];
|
|
109
|
+
/**
|
|
110
|
+
* Create an Array with a copy of the Ranges data
|
|
111
|
+
* @memberof Range
|
|
112
|
+
* @returns {Array} array
|
|
113
|
+
*/
|
|
114
|
+
toArray(): number[];
|
|
115
|
+
/**
|
|
116
|
+
* Get the primitive value of the Range, a one dimensional array
|
|
117
|
+
* @memberof Range
|
|
118
|
+
* @returns {Array} array
|
|
119
|
+
*/
|
|
120
|
+
valueOf(): number[];
|
|
121
|
+
/**
|
|
122
|
+
* Get a string representation of the range, with optional formatting options.
|
|
123
|
+
* Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'
|
|
124
|
+
* @memberof Range
|
|
125
|
+
* @param {Object | number | function} [options] Formatting options. See
|
|
126
|
+
* lib/utils/number:format for a
|
|
127
|
+
* description of the available
|
|
128
|
+
* options.
|
|
129
|
+
* @returns {string} str
|
|
130
|
+
*/
|
|
131
|
+
format(options?: RangeFormatOptions | number | ((value: number) => string)): string;
|
|
132
|
+
/**
|
|
133
|
+
* Get a string representation of the range.
|
|
134
|
+
* @memberof Range
|
|
135
|
+
* @returns {string}
|
|
136
|
+
*/
|
|
137
|
+
toString(): string;
|
|
138
|
+
/**
|
|
139
|
+
* Get a JSON representation of the range
|
|
140
|
+
* @memberof Range
|
|
141
|
+
* @returns {Object} Returns a JSON object structured as:
|
|
142
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
143
|
+
*/
|
|
144
|
+
toJSON(): RangeJSON;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Parse a string into a range,
|
|
148
|
+
* The string contains the start, optional step, and end, separated by a colon.
|
|
149
|
+
* If the string does not contain a valid range, null is returned.
|
|
150
|
+
* For example str='0:2:11'.
|
|
151
|
+
* @memberof Range
|
|
152
|
+
* @param {string} str
|
|
153
|
+
* @return {Range | null} range
|
|
154
|
+
*/
|
|
155
|
+
parse(str: string): {
|
|
156
|
+
/**
|
|
157
|
+
* Type identifier
|
|
158
|
+
*/
|
|
159
|
+
readonly type: string;
|
|
160
|
+
/**
|
|
161
|
+
* Range type flag
|
|
162
|
+
*/
|
|
163
|
+
readonly isRange: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Start value of the range (inclusive)
|
|
166
|
+
*/
|
|
167
|
+
start: number;
|
|
168
|
+
/**
|
|
169
|
+
* End value of the range (exclusive)
|
|
170
|
+
*/
|
|
171
|
+
end: number;
|
|
172
|
+
/**
|
|
173
|
+
* Step size for the range
|
|
174
|
+
*/
|
|
175
|
+
step: number;
|
|
176
|
+
/**
|
|
177
|
+
* Cached primitive array representation.
|
|
178
|
+
*
|
|
179
|
+
* @internal Not part of the public API.
|
|
180
|
+
*
|
|
181
|
+
* These four were ES-private (`#cache`) until TypeScript 7. This class is
|
|
182
|
+
* returned from a `factory()` call, so declaration emit describes it as an
|
|
183
|
+
* ANONYMOUS class type -- and TS4094 forbids private or protected members
|
|
184
|
+
* there, because an anonymous type has no name to refer them to. The
|
|
185
|
+
* underscore prefix keeps the "do not touch" signal without the emit
|
|
186
|
+
* failure. Restore `#` if the class is ever hoisted out of the factory.
|
|
187
|
+
*/
|
|
188
|
+
_cache: number[] | null;
|
|
189
|
+
_cacheStart?: number;
|
|
190
|
+
_cacheEnd?: number;
|
|
191
|
+
_cacheStep?: number;
|
|
192
|
+
/**
|
|
193
|
+
* Create a clone of the range
|
|
194
|
+
* @return {Range} clone
|
|
195
|
+
*/
|
|
196
|
+
clone(): /*elided*/ any;
|
|
197
|
+
/**
|
|
198
|
+
* Retrieve the size of the range.
|
|
199
|
+
* Returns an array containing one number, the number of elements in the range.
|
|
200
|
+
* @memberof Range
|
|
201
|
+
* @returns {number[]} size
|
|
202
|
+
*/
|
|
203
|
+
size(): number[];
|
|
204
|
+
/**
|
|
205
|
+
* Calculate the minimum value in the range
|
|
206
|
+
* @memberof Range
|
|
207
|
+
* @return {number | undefined} min
|
|
208
|
+
*/
|
|
209
|
+
min(): number | undefined;
|
|
210
|
+
/**
|
|
211
|
+
* Calculate the maximum value in the range
|
|
212
|
+
* @memberof Range
|
|
213
|
+
* @return {number | undefined} max
|
|
214
|
+
*/
|
|
215
|
+
max(): number | undefined;
|
|
216
|
+
/**
|
|
217
|
+
* Execute a callback function for each value in the range.
|
|
218
|
+
* @memberof Range
|
|
219
|
+
* @param {function} callback The callback method is invoked with three
|
|
220
|
+
* parameters: the value of the element, the index
|
|
221
|
+
* of the element, and the Range being traversed.
|
|
222
|
+
*/
|
|
223
|
+
forEach(callback: RangeForEachCallback): void;
|
|
224
|
+
/**
|
|
225
|
+
* Execute a callback function for each value in the Range, and return the
|
|
226
|
+
* results as an array
|
|
227
|
+
* @memberof Range
|
|
228
|
+
* @param {function} callback The callback method is invoked with three
|
|
229
|
+
* parameters: the value of the element, the index
|
|
230
|
+
* of the element, and the Matrix being traversed.
|
|
231
|
+
* @returns {Array} array
|
|
232
|
+
*/
|
|
233
|
+
map<T>(callback: RangeMapCallback<T>): T[];
|
|
234
|
+
/**
|
|
235
|
+
* Create an Array with a copy of the Ranges data
|
|
236
|
+
* @memberof Range
|
|
237
|
+
* @returns {Array} array
|
|
238
|
+
*/
|
|
239
|
+
toArray(): number[];
|
|
240
|
+
/**
|
|
241
|
+
* Get the primitive value of the Range, a one dimensional array
|
|
242
|
+
* @memberof Range
|
|
243
|
+
* @returns {Array} array
|
|
244
|
+
*/
|
|
245
|
+
valueOf(): number[];
|
|
246
|
+
/**
|
|
247
|
+
* Get a string representation of the range, with optional formatting options.
|
|
248
|
+
* Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'
|
|
249
|
+
* @memberof Range
|
|
250
|
+
* @param {Object | number | function} [options] Formatting options. See
|
|
251
|
+
* lib/utils/number:format for a
|
|
252
|
+
* description of the available
|
|
253
|
+
* options.
|
|
254
|
+
* @returns {string} str
|
|
255
|
+
*/
|
|
256
|
+
format(options?: RangeFormatOptions | number | ((value: number) => string)): string;
|
|
257
|
+
/**
|
|
258
|
+
* Get a string representation of the range.
|
|
259
|
+
* @memberof Range
|
|
260
|
+
* @returns {string}
|
|
261
|
+
*/
|
|
262
|
+
toString(): string;
|
|
263
|
+
/**
|
|
264
|
+
* Get a JSON representation of the range
|
|
265
|
+
* @memberof Range
|
|
266
|
+
* @returns {Object} Returns a JSON object structured as:
|
|
267
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
268
|
+
*/
|
|
269
|
+
toJSON(): RangeJSON;
|
|
270
|
+
} | null;
|
|
271
|
+
/**
|
|
272
|
+
* Instantiate a Range from a JSON object
|
|
273
|
+
* @memberof Range
|
|
274
|
+
* @param {Object} json A JSON object structured as:
|
|
275
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
276
|
+
* @return {Range}
|
|
277
|
+
*/
|
|
278
|
+
fromJSON(json: RangeJSON): {
|
|
279
|
+
/**
|
|
280
|
+
* Type identifier
|
|
281
|
+
*/
|
|
282
|
+
readonly type: string;
|
|
283
|
+
/**
|
|
284
|
+
* Range type flag
|
|
285
|
+
*/
|
|
286
|
+
readonly isRange: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Start value of the range (inclusive)
|
|
289
|
+
*/
|
|
290
|
+
start: number;
|
|
291
|
+
/**
|
|
292
|
+
* End value of the range (exclusive)
|
|
293
|
+
*/
|
|
294
|
+
end: number;
|
|
295
|
+
/**
|
|
296
|
+
* Step size for the range
|
|
297
|
+
*/
|
|
298
|
+
step: number;
|
|
299
|
+
/**
|
|
300
|
+
* Cached primitive array representation.
|
|
301
|
+
*
|
|
302
|
+
* @internal Not part of the public API.
|
|
303
|
+
*
|
|
304
|
+
* These four were ES-private (`#cache`) until TypeScript 7. This class is
|
|
305
|
+
* returned from a `factory()` call, so declaration emit describes it as an
|
|
306
|
+
* ANONYMOUS class type -- and TS4094 forbids private or protected members
|
|
307
|
+
* there, because an anonymous type has no name to refer them to. The
|
|
308
|
+
* underscore prefix keeps the "do not touch" signal without the emit
|
|
309
|
+
* failure. Restore `#` if the class is ever hoisted out of the factory.
|
|
310
|
+
*/
|
|
311
|
+
_cache: number[] | null;
|
|
312
|
+
_cacheStart?: number;
|
|
313
|
+
_cacheEnd?: number;
|
|
314
|
+
_cacheStep?: number;
|
|
315
|
+
/**
|
|
316
|
+
* Create a clone of the range
|
|
317
|
+
* @return {Range} clone
|
|
318
|
+
*/
|
|
319
|
+
clone(): /*elided*/ any;
|
|
320
|
+
/**
|
|
321
|
+
* Retrieve the size of the range.
|
|
322
|
+
* Returns an array containing one number, the number of elements in the range.
|
|
323
|
+
* @memberof Range
|
|
324
|
+
* @returns {number[]} size
|
|
325
|
+
*/
|
|
326
|
+
size(): number[];
|
|
327
|
+
/**
|
|
328
|
+
* Calculate the minimum value in the range
|
|
329
|
+
* @memberof Range
|
|
330
|
+
* @return {number | undefined} min
|
|
331
|
+
*/
|
|
332
|
+
min(): number | undefined;
|
|
333
|
+
/**
|
|
334
|
+
* Calculate the maximum value in the range
|
|
335
|
+
* @memberof Range
|
|
336
|
+
* @return {number | undefined} max
|
|
337
|
+
*/
|
|
338
|
+
max(): number | undefined;
|
|
339
|
+
/**
|
|
340
|
+
* Execute a callback function for each value in the range.
|
|
341
|
+
* @memberof Range
|
|
342
|
+
* @param {function} callback The callback method is invoked with three
|
|
343
|
+
* parameters: the value of the element, the index
|
|
344
|
+
* of the element, and the Range being traversed.
|
|
345
|
+
*/
|
|
346
|
+
forEach(callback: RangeForEachCallback): void;
|
|
347
|
+
/**
|
|
348
|
+
* Execute a callback function for each value in the Range, and return the
|
|
349
|
+
* results as an array
|
|
350
|
+
* @memberof Range
|
|
351
|
+
* @param {function} callback The callback method is invoked with three
|
|
352
|
+
* parameters: the value of the element, the index
|
|
353
|
+
* of the element, and the Matrix being traversed.
|
|
354
|
+
* @returns {Array} array
|
|
355
|
+
*/
|
|
356
|
+
map<T>(callback: RangeMapCallback<T>): T[];
|
|
357
|
+
/**
|
|
358
|
+
* Create an Array with a copy of the Ranges data
|
|
359
|
+
* @memberof Range
|
|
360
|
+
* @returns {Array} array
|
|
361
|
+
*/
|
|
362
|
+
toArray(): number[];
|
|
363
|
+
/**
|
|
364
|
+
* Get the primitive value of the Range, a one dimensional array
|
|
365
|
+
* @memberof Range
|
|
366
|
+
* @returns {Array} array
|
|
367
|
+
*/
|
|
368
|
+
valueOf(): number[];
|
|
369
|
+
/**
|
|
370
|
+
* Get a string representation of the range, with optional formatting options.
|
|
371
|
+
* Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'
|
|
372
|
+
* @memberof Range
|
|
373
|
+
* @param {Object | number | function} [options] Formatting options. See
|
|
374
|
+
* lib/utils/number:format for a
|
|
375
|
+
* description of the available
|
|
376
|
+
* options.
|
|
377
|
+
* @returns {string} str
|
|
378
|
+
*/
|
|
379
|
+
format(options?: RangeFormatOptions | number | ((value: number) => string)): string;
|
|
380
|
+
/**
|
|
381
|
+
* Get a string representation of the range.
|
|
382
|
+
* @memberof Range
|
|
383
|
+
* @returns {string}
|
|
384
|
+
*/
|
|
385
|
+
toString(): string;
|
|
386
|
+
/**
|
|
387
|
+
* Get a JSON representation of the range
|
|
388
|
+
* @memberof Range
|
|
389
|
+
* @returns {Object} Returns a JSON object structured as:
|
|
390
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
391
|
+
*/
|
|
392
|
+
toJSON(): RangeJSON;
|
|
393
|
+
};
|
|
394
|
+
}>;
|
|
395
|
+
/**
|
|
396
|
+
* Ready-made `Range` class (the factory instantiated with no dependencies),
|
|
397
|
+
* exported for direct use from the package index — mirrors how core ships a
|
|
398
|
+
* ready-made `Complex`/`Fraction`/`Unit` alongside its factory.
|
|
399
|
+
*/
|
|
400
|
+
export declare const Range: {
|
|
401
|
+
new (start?: number | bigint | BigNumber | null, end?: number | bigint | BigNumber | null, step?: number | bigint | BigNumber | null): {
|
|
402
|
+
/**
|
|
403
|
+
* Type identifier
|
|
404
|
+
*/
|
|
405
|
+
readonly type: string;
|
|
406
|
+
/**
|
|
407
|
+
* Range type flag
|
|
408
|
+
*/
|
|
409
|
+
readonly isRange: boolean;
|
|
410
|
+
/**
|
|
411
|
+
* Start value of the range (inclusive)
|
|
412
|
+
*/
|
|
413
|
+
start: number;
|
|
414
|
+
/**
|
|
415
|
+
* End value of the range (exclusive)
|
|
416
|
+
*/
|
|
417
|
+
end: number;
|
|
418
|
+
/**
|
|
419
|
+
* Step size for the range
|
|
420
|
+
*/
|
|
421
|
+
step: number;
|
|
422
|
+
/**
|
|
423
|
+
* Cached primitive array representation.
|
|
424
|
+
*
|
|
425
|
+
* @internal Not part of the public API.
|
|
426
|
+
*
|
|
427
|
+
* These four were ES-private (`#cache`) until TypeScript 7. This class is
|
|
428
|
+
* returned from a `factory()` call, so declaration emit describes it as an
|
|
429
|
+
* ANONYMOUS class type -- and TS4094 forbids private or protected members
|
|
430
|
+
* there, because an anonymous type has no name to refer them to. The
|
|
431
|
+
* underscore prefix keeps the "do not touch" signal without the emit
|
|
432
|
+
* failure. Restore `#` if the class is ever hoisted out of the factory.
|
|
433
|
+
*/
|
|
434
|
+
_cache: number[] | null;
|
|
435
|
+
_cacheStart?: number;
|
|
436
|
+
_cacheEnd?: number;
|
|
437
|
+
_cacheStep?: number;
|
|
438
|
+
/**
|
|
439
|
+
* Create a clone of the range
|
|
440
|
+
* @return {Range} clone
|
|
441
|
+
*/
|
|
442
|
+
clone(): /*elided*/ any;
|
|
443
|
+
/**
|
|
444
|
+
* Retrieve the size of the range.
|
|
445
|
+
* Returns an array containing one number, the number of elements in the range.
|
|
446
|
+
* @memberof Range
|
|
447
|
+
* @returns {number[]} size
|
|
448
|
+
*/
|
|
449
|
+
size(): number[];
|
|
450
|
+
/**
|
|
451
|
+
* Calculate the minimum value in the range
|
|
452
|
+
* @memberof Range
|
|
453
|
+
* @return {number | undefined} min
|
|
454
|
+
*/
|
|
455
|
+
min(): number | undefined;
|
|
456
|
+
/**
|
|
457
|
+
* Calculate the maximum value in the range
|
|
458
|
+
* @memberof Range
|
|
459
|
+
* @return {number | undefined} max
|
|
460
|
+
*/
|
|
461
|
+
max(): number | undefined;
|
|
462
|
+
/**
|
|
463
|
+
* Execute a callback function for each value in the range.
|
|
464
|
+
* @memberof Range
|
|
465
|
+
* @param {function} callback The callback method is invoked with three
|
|
466
|
+
* parameters: the value of the element, the index
|
|
467
|
+
* of the element, and the Range being traversed.
|
|
468
|
+
*/
|
|
469
|
+
forEach(callback: RangeForEachCallback): void;
|
|
470
|
+
/**
|
|
471
|
+
* Execute a callback function for each value in the Range, and return the
|
|
472
|
+
* results as an array
|
|
473
|
+
* @memberof Range
|
|
474
|
+
* @param {function} callback The callback method is invoked with three
|
|
475
|
+
* parameters: the value of the element, the index
|
|
476
|
+
* of the element, and the Matrix being traversed.
|
|
477
|
+
* @returns {Array} array
|
|
478
|
+
*/
|
|
479
|
+
map<T>(callback: RangeMapCallback<T>): T[];
|
|
480
|
+
/**
|
|
481
|
+
* Create an Array with a copy of the Ranges data
|
|
482
|
+
* @memberof Range
|
|
483
|
+
* @returns {Array} array
|
|
484
|
+
*/
|
|
485
|
+
toArray(): number[];
|
|
486
|
+
/**
|
|
487
|
+
* Get the primitive value of the Range, a one dimensional array
|
|
488
|
+
* @memberof Range
|
|
489
|
+
* @returns {Array} array
|
|
490
|
+
*/
|
|
491
|
+
valueOf(): number[];
|
|
492
|
+
/**
|
|
493
|
+
* Get a string representation of the range, with optional formatting options.
|
|
494
|
+
* Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'
|
|
495
|
+
* @memberof Range
|
|
496
|
+
* @param {Object | number | function} [options] Formatting options. See
|
|
497
|
+
* lib/utils/number:format for a
|
|
498
|
+
* description of the available
|
|
499
|
+
* options.
|
|
500
|
+
* @returns {string} str
|
|
501
|
+
*/
|
|
502
|
+
format(options?: RangeFormatOptions | number | ((value: number) => string)): string;
|
|
503
|
+
/**
|
|
504
|
+
* Get a string representation of the range.
|
|
505
|
+
* @memberof Range
|
|
506
|
+
* @returns {string}
|
|
507
|
+
*/
|
|
508
|
+
toString(): string;
|
|
509
|
+
/**
|
|
510
|
+
* Get a JSON representation of the range
|
|
511
|
+
* @memberof Range
|
|
512
|
+
* @returns {Object} Returns a JSON object structured as:
|
|
513
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
514
|
+
*/
|
|
515
|
+
toJSON(): RangeJSON;
|
|
516
|
+
};
|
|
517
|
+
/**
|
|
518
|
+
* Parse a string into a range,
|
|
519
|
+
* The string contains the start, optional step, and end, separated by a colon.
|
|
520
|
+
* If the string does not contain a valid range, null is returned.
|
|
521
|
+
* For example str='0:2:11'.
|
|
522
|
+
* @memberof Range
|
|
523
|
+
* @param {string} str
|
|
524
|
+
* @return {Range | null} range
|
|
525
|
+
*/
|
|
526
|
+
parse(str: string): {
|
|
527
|
+
/**
|
|
528
|
+
* Type identifier
|
|
529
|
+
*/
|
|
530
|
+
readonly type: string;
|
|
531
|
+
/**
|
|
532
|
+
* Range type flag
|
|
533
|
+
*/
|
|
534
|
+
readonly isRange: boolean;
|
|
535
|
+
/**
|
|
536
|
+
* Start value of the range (inclusive)
|
|
537
|
+
*/
|
|
538
|
+
start: number;
|
|
539
|
+
/**
|
|
540
|
+
* End value of the range (exclusive)
|
|
541
|
+
*/
|
|
542
|
+
end: number;
|
|
543
|
+
/**
|
|
544
|
+
* Step size for the range
|
|
545
|
+
*/
|
|
546
|
+
step: number;
|
|
547
|
+
/**
|
|
548
|
+
* Cached primitive array representation.
|
|
549
|
+
*
|
|
550
|
+
* @internal Not part of the public API.
|
|
551
|
+
*
|
|
552
|
+
* These four were ES-private (`#cache`) until TypeScript 7. This class is
|
|
553
|
+
* returned from a `factory()` call, so declaration emit describes it as an
|
|
554
|
+
* ANONYMOUS class type -- and TS4094 forbids private or protected members
|
|
555
|
+
* there, because an anonymous type has no name to refer them to. The
|
|
556
|
+
* underscore prefix keeps the "do not touch" signal without the emit
|
|
557
|
+
* failure. Restore `#` if the class is ever hoisted out of the factory.
|
|
558
|
+
*/
|
|
559
|
+
_cache: number[] | null;
|
|
560
|
+
_cacheStart?: number;
|
|
561
|
+
_cacheEnd?: number;
|
|
562
|
+
_cacheStep?: number;
|
|
563
|
+
/**
|
|
564
|
+
* Create a clone of the range
|
|
565
|
+
* @return {Range} clone
|
|
566
|
+
*/
|
|
567
|
+
clone(): /*elided*/ any;
|
|
568
|
+
/**
|
|
569
|
+
* Retrieve the size of the range.
|
|
570
|
+
* Returns an array containing one number, the number of elements in the range.
|
|
571
|
+
* @memberof Range
|
|
572
|
+
* @returns {number[]} size
|
|
573
|
+
*/
|
|
574
|
+
size(): number[];
|
|
575
|
+
/**
|
|
576
|
+
* Calculate the minimum value in the range
|
|
577
|
+
* @memberof Range
|
|
578
|
+
* @return {number | undefined} min
|
|
579
|
+
*/
|
|
580
|
+
min(): number | undefined;
|
|
581
|
+
/**
|
|
582
|
+
* Calculate the maximum value in the range
|
|
583
|
+
* @memberof Range
|
|
584
|
+
* @return {number | undefined} max
|
|
585
|
+
*/
|
|
586
|
+
max(): number | undefined;
|
|
587
|
+
/**
|
|
588
|
+
* Execute a callback function for each value in the range.
|
|
589
|
+
* @memberof Range
|
|
590
|
+
* @param {function} callback The callback method is invoked with three
|
|
591
|
+
* parameters: the value of the element, the index
|
|
592
|
+
* of the element, and the Range being traversed.
|
|
593
|
+
*/
|
|
594
|
+
forEach(callback: RangeForEachCallback): void;
|
|
595
|
+
/**
|
|
596
|
+
* Execute a callback function for each value in the Range, and return the
|
|
597
|
+
* results as an array
|
|
598
|
+
* @memberof Range
|
|
599
|
+
* @param {function} callback The callback method is invoked with three
|
|
600
|
+
* parameters: the value of the element, the index
|
|
601
|
+
* of the element, and the Matrix being traversed.
|
|
602
|
+
* @returns {Array} array
|
|
603
|
+
*/
|
|
604
|
+
map<T>(callback: RangeMapCallback<T>): T[];
|
|
605
|
+
/**
|
|
606
|
+
* Create an Array with a copy of the Ranges data
|
|
607
|
+
* @memberof Range
|
|
608
|
+
* @returns {Array} array
|
|
609
|
+
*/
|
|
610
|
+
toArray(): number[];
|
|
611
|
+
/**
|
|
612
|
+
* Get the primitive value of the Range, a one dimensional array
|
|
613
|
+
* @memberof Range
|
|
614
|
+
* @returns {Array} array
|
|
615
|
+
*/
|
|
616
|
+
valueOf(): number[];
|
|
617
|
+
/**
|
|
618
|
+
* Get a string representation of the range, with optional formatting options.
|
|
619
|
+
* Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'
|
|
620
|
+
* @memberof Range
|
|
621
|
+
* @param {Object | number | function} [options] Formatting options. See
|
|
622
|
+
* lib/utils/number:format for a
|
|
623
|
+
* description of the available
|
|
624
|
+
* options.
|
|
625
|
+
* @returns {string} str
|
|
626
|
+
*/
|
|
627
|
+
format(options?: RangeFormatOptions | number | ((value: number) => string)): string;
|
|
628
|
+
/**
|
|
629
|
+
* Get a string representation of the range.
|
|
630
|
+
* @memberof Range
|
|
631
|
+
* @returns {string}
|
|
632
|
+
*/
|
|
633
|
+
toString(): string;
|
|
634
|
+
/**
|
|
635
|
+
* Get a JSON representation of the range
|
|
636
|
+
* @memberof Range
|
|
637
|
+
* @returns {Object} Returns a JSON object structured as:
|
|
638
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
639
|
+
*/
|
|
640
|
+
toJSON(): RangeJSON;
|
|
641
|
+
} | null;
|
|
642
|
+
/**
|
|
643
|
+
* Instantiate a Range from a JSON object
|
|
644
|
+
* @memberof Range
|
|
645
|
+
* @param {Object} json A JSON object structured as:
|
|
646
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
647
|
+
* @return {Range}
|
|
648
|
+
*/
|
|
649
|
+
fromJSON(json: RangeJSON): {
|
|
650
|
+
/**
|
|
651
|
+
* Type identifier
|
|
652
|
+
*/
|
|
653
|
+
readonly type: string;
|
|
654
|
+
/**
|
|
655
|
+
* Range type flag
|
|
656
|
+
*/
|
|
657
|
+
readonly isRange: boolean;
|
|
658
|
+
/**
|
|
659
|
+
* Start value of the range (inclusive)
|
|
660
|
+
*/
|
|
661
|
+
start: number;
|
|
662
|
+
/**
|
|
663
|
+
* End value of the range (exclusive)
|
|
664
|
+
*/
|
|
665
|
+
end: number;
|
|
666
|
+
/**
|
|
667
|
+
* Step size for the range
|
|
668
|
+
*/
|
|
669
|
+
step: number;
|
|
670
|
+
/**
|
|
671
|
+
* Cached primitive array representation.
|
|
672
|
+
*
|
|
673
|
+
* @internal Not part of the public API.
|
|
674
|
+
*
|
|
675
|
+
* These four were ES-private (`#cache`) until TypeScript 7. This class is
|
|
676
|
+
* returned from a `factory()` call, so declaration emit describes it as an
|
|
677
|
+
* ANONYMOUS class type -- and TS4094 forbids private or protected members
|
|
678
|
+
* there, because an anonymous type has no name to refer them to. The
|
|
679
|
+
* underscore prefix keeps the "do not touch" signal without the emit
|
|
680
|
+
* failure. Restore `#` if the class is ever hoisted out of the factory.
|
|
681
|
+
*/
|
|
682
|
+
_cache: number[] | null;
|
|
683
|
+
_cacheStart?: number;
|
|
684
|
+
_cacheEnd?: number;
|
|
685
|
+
_cacheStep?: number;
|
|
686
|
+
/**
|
|
687
|
+
* Create a clone of the range
|
|
688
|
+
* @return {Range} clone
|
|
689
|
+
*/
|
|
690
|
+
clone(): /*elided*/ any;
|
|
691
|
+
/**
|
|
692
|
+
* Retrieve the size of the range.
|
|
693
|
+
* Returns an array containing one number, the number of elements in the range.
|
|
694
|
+
* @memberof Range
|
|
695
|
+
* @returns {number[]} size
|
|
696
|
+
*/
|
|
697
|
+
size(): number[];
|
|
698
|
+
/**
|
|
699
|
+
* Calculate the minimum value in the range
|
|
700
|
+
* @memberof Range
|
|
701
|
+
* @return {number | undefined} min
|
|
702
|
+
*/
|
|
703
|
+
min(): number | undefined;
|
|
704
|
+
/**
|
|
705
|
+
* Calculate the maximum value in the range
|
|
706
|
+
* @memberof Range
|
|
707
|
+
* @return {number | undefined} max
|
|
708
|
+
*/
|
|
709
|
+
max(): number | undefined;
|
|
710
|
+
/**
|
|
711
|
+
* Execute a callback function for each value in the range.
|
|
712
|
+
* @memberof Range
|
|
713
|
+
* @param {function} callback The callback method is invoked with three
|
|
714
|
+
* parameters: the value of the element, the index
|
|
715
|
+
* of the element, and the Range being traversed.
|
|
716
|
+
*/
|
|
717
|
+
forEach(callback: RangeForEachCallback): void;
|
|
718
|
+
/**
|
|
719
|
+
* Execute a callback function for each value in the Range, and return the
|
|
720
|
+
* results as an array
|
|
721
|
+
* @memberof Range
|
|
722
|
+
* @param {function} callback The callback method is invoked with three
|
|
723
|
+
* parameters: the value of the element, the index
|
|
724
|
+
* of the element, and the Matrix being traversed.
|
|
725
|
+
* @returns {Array} array
|
|
726
|
+
*/
|
|
727
|
+
map<T>(callback: RangeMapCallback<T>): T[];
|
|
728
|
+
/**
|
|
729
|
+
* Create an Array with a copy of the Ranges data
|
|
730
|
+
* @memberof Range
|
|
731
|
+
* @returns {Array} array
|
|
732
|
+
*/
|
|
733
|
+
toArray(): number[];
|
|
734
|
+
/**
|
|
735
|
+
* Get the primitive value of the Range, a one dimensional array
|
|
736
|
+
* @memberof Range
|
|
737
|
+
* @returns {Array} array
|
|
738
|
+
*/
|
|
739
|
+
valueOf(): number[];
|
|
740
|
+
/**
|
|
741
|
+
* Get a string representation of the range, with optional formatting options.
|
|
742
|
+
* Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'
|
|
743
|
+
* @memberof Range
|
|
744
|
+
* @param {Object | number | function} [options] Formatting options. See
|
|
745
|
+
* lib/utils/number:format for a
|
|
746
|
+
* description of the available
|
|
747
|
+
* options.
|
|
748
|
+
* @returns {string} str
|
|
749
|
+
*/
|
|
750
|
+
format(options?: RangeFormatOptions | number | ((value: number) => string)): string;
|
|
751
|
+
/**
|
|
752
|
+
* Get a string representation of the range.
|
|
753
|
+
* @memberof Range
|
|
754
|
+
* @returns {string}
|
|
755
|
+
*/
|
|
756
|
+
toString(): string;
|
|
757
|
+
/**
|
|
758
|
+
* Get a JSON representation of the range
|
|
759
|
+
* @memberof Range
|
|
760
|
+
* @returns {Object} Returns a JSON object structured as:
|
|
761
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
762
|
+
*/
|
|
763
|
+
toJSON(): RangeJSON;
|
|
764
|
+
};
|
|
765
|
+
};
|
|
766
|
+
export {};
|
|
767
|
+
//# sourceMappingURL=Range.d.ts.map
|