@danielsimonjr/mathts-core 0.5.0 → 0.6.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/{chunk-BDNTTHO4.js → chunk-AMOHH5MP.js} +2298 -2297
- package/dist/{index-DpOizJsa.d.ts → index-zKEDY9aj.d.ts} +29 -1
- package/dist/index.d.ts +715 -2
- package/dist/index.js +349 -41
- package/dist/internal.d.ts +2 -30
- package/dist/internal.js +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27,18 +27,324 @@ import {
|
|
|
27
27
|
addScalar,
|
|
28
28
|
divideScalar,
|
|
29
29
|
equal,
|
|
30
|
+
factory,
|
|
30
31
|
fix,
|
|
32
|
+
format,
|
|
33
|
+
isBigInt,
|
|
31
34
|
isBigNumber,
|
|
35
|
+
isBigNumber2,
|
|
32
36
|
isComplex,
|
|
33
|
-
isFraction,
|
|
37
|
+
isFraction2 as isFraction,
|
|
34
38
|
isNumeric,
|
|
35
39
|
isUnit,
|
|
36
40
|
multiplyScalar,
|
|
41
|
+
nearlyEqual,
|
|
37
42
|
number,
|
|
38
43
|
pow,
|
|
39
44
|
round,
|
|
45
|
+
sign,
|
|
40
46
|
subtractScalar
|
|
41
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-AMOHH5MP.js";
|
|
48
|
+
|
|
49
|
+
// src/types/matrix/Range.ts
|
|
50
|
+
var name = "Range";
|
|
51
|
+
var dependencies = [];
|
|
52
|
+
var createRangeClass = /* @__PURE__ */ factory(
|
|
53
|
+
name,
|
|
54
|
+
dependencies,
|
|
55
|
+
() => {
|
|
56
|
+
class Range2 {
|
|
57
|
+
/**
|
|
58
|
+
* Type identifier
|
|
59
|
+
*/
|
|
60
|
+
type = "Range";
|
|
61
|
+
/**
|
|
62
|
+
* Range type flag
|
|
63
|
+
*/
|
|
64
|
+
isRange = true;
|
|
65
|
+
/**
|
|
66
|
+
* Start value of the range (inclusive)
|
|
67
|
+
*/
|
|
68
|
+
start;
|
|
69
|
+
/**
|
|
70
|
+
* End value of the range (exclusive)
|
|
71
|
+
*/
|
|
72
|
+
end;
|
|
73
|
+
/**
|
|
74
|
+
* Step size for the range
|
|
75
|
+
*/
|
|
76
|
+
step;
|
|
77
|
+
/**
|
|
78
|
+
* Cached primitive array representation
|
|
79
|
+
*/
|
|
80
|
+
#cache = null;
|
|
81
|
+
#cacheStart;
|
|
82
|
+
#cacheEnd;
|
|
83
|
+
#cacheStep;
|
|
84
|
+
constructor(start, end, step) {
|
|
85
|
+
if (!(this instanceof Range2)) {
|
|
86
|
+
throw new SyntaxError("Constructor must be called with the new operator");
|
|
87
|
+
}
|
|
88
|
+
const hasStart = start !== null && start !== void 0;
|
|
89
|
+
const hasEnd = end !== null && end !== void 0;
|
|
90
|
+
const hasStep = step !== null && step !== void 0;
|
|
91
|
+
let startValue = 0;
|
|
92
|
+
let endValue = 0;
|
|
93
|
+
let stepValue = 1;
|
|
94
|
+
if (hasStart) {
|
|
95
|
+
if (isBigNumber(start)) {
|
|
96
|
+
startValue = start.toNumber();
|
|
97
|
+
} else if (typeof start !== "number" && !isBigInt(start)) {
|
|
98
|
+
throw new TypeError("Parameter start must be a number or bigint");
|
|
99
|
+
} else {
|
|
100
|
+
startValue = start;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (hasEnd) {
|
|
104
|
+
if (isBigNumber(end)) {
|
|
105
|
+
endValue = end.toNumber();
|
|
106
|
+
} else if (typeof end !== "number" && !isBigInt(end)) {
|
|
107
|
+
throw new TypeError("Parameter end must be a number or bigint");
|
|
108
|
+
} else {
|
|
109
|
+
endValue = end;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (hasStep) {
|
|
113
|
+
if (isBigNumber(step)) {
|
|
114
|
+
stepValue = step.toNumber();
|
|
115
|
+
} else if (typeof step !== "number" && !isBigInt(step)) {
|
|
116
|
+
throw new TypeError("Parameter step must be a number or bigint");
|
|
117
|
+
} else {
|
|
118
|
+
stepValue = step;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
this.start = hasStart ? parseFloat(startValue.toString()) : 0;
|
|
122
|
+
this.end = hasEnd ? parseFloat(endValue.toString()) : 0;
|
|
123
|
+
this.step = hasStep ? parseFloat(stepValue.toString()) : 1;
|
|
124
|
+
if (hasStep && nearlyEqual(this.step, 0)) {
|
|
125
|
+
throw new Error("Step must not be zero");
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Parse a string into a range,
|
|
130
|
+
* The string contains the start, optional step, and end, separated by a colon.
|
|
131
|
+
* If the string does not contain a valid range, null is returned.
|
|
132
|
+
* For example str='0:2:11'.
|
|
133
|
+
* @memberof Range
|
|
134
|
+
* @param {string} str
|
|
135
|
+
* @return {Range | null} range
|
|
136
|
+
*/
|
|
137
|
+
static parse(str) {
|
|
138
|
+
if (typeof str !== "string") {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
const args = str.split(":");
|
|
142
|
+
const nums = args.map(function(arg) {
|
|
143
|
+
return parseFloat(arg);
|
|
144
|
+
});
|
|
145
|
+
const invalid = nums.some(function(num) {
|
|
146
|
+
return isNaN(num);
|
|
147
|
+
});
|
|
148
|
+
if (invalid) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
switch (nums.length) {
|
|
152
|
+
case 2:
|
|
153
|
+
return new Range2(nums[0], nums[1]);
|
|
154
|
+
case 3:
|
|
155
|
+
return new Range2(nums[0], nums[2], nums[1]);
|
|
156
|
+
default:
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Create a clone of the range
|
|
162
|
+
* @return {Range} clone
|
|
163
|
+
*/
|
|
164
|
+
clone() {
|
|
165
|
+
return new Range2(this.start, this.end, this.step);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Retrieve the size of the range.
|
|
169
|
+
* Returns an array containing one number, the number of elements in the range.
|
|
170
|
+
* @memberof Range
|
|
171
|
+
* @returns {number[]} size
|
|
172
|
+
*/
|
|
173
|
+
size() {
|
|
174
|
+
let len = 0;
|
|
175
|
+
const start = this.start;
|
|
176
|
+
const step = this.step;
|
|
177
|
+
const end = this.end;
|
|
178
|
+
const diff = end - start;
|
|
179
|
+
if (sign(step) === sign(diff)) {
|
|
180
|
+
len = Math.ceil(diff / step);
|
|
181
|
+
} else if (diff === 0) {
|
|
182
|
+
len = 0;
|
|
183
|
+
}
|
|
184
|
+
if (isNaN(len)) {
|
|
185
|
+
len = 0;
|
|
186
|
+
}
|
|
187
|
+
return [len];
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Calculate the minimum value in the range
|
|
191
|
+
* @memberof Range
|
|
192
|
+
* @return {number | undefined} min
|
|
193
|
+
*/
|
|
194
|
+
min() {
|
|
195
|
+
const size = this.size()[0];
|
|
196
|
+
if (size > 0) {
|
|
197
|
+
if (this.step > 0) {
|
|
198
|
+
return this.start;
|
|
199
|
+
} else {
|
|
200
|
+
return this.start + (size - 1) * this.step;
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
return void 0;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Calculate the maximum value in the range
|
|
208
|
+
* @memberof Range
|
|
209
|
+
* @return {number | undefined} max
|
|
210
|
+
*/
|
|
211
|
+
max() {
|
|
212
|
+
const size = this.size()[0];
|
|
213
|
+
if (size > 0) {
|
|
214
|
+
if (this.step > 0) {
|
|
215
|
+
return this.start + (size - 1) * this.step;
|
|
216
|
+
} else {
|
|
217
|
+
return this.start;
|
|
218
|
+
}
|
|
219
|
+
} else {
|
|
220
|
+
return void 0;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Execute a callback function for each value in the range.
|
|
225
|
+
* @memberof Range
|
|
226
|
+
* @param {function} callback The callback method is invoked with three
|
|
227
|
+
* parameters: the value of the element, the index
|
|
228
|
+
* of the element, and the Range being traversed.
|
|
229
|
+
*/
|
|
230
|
+
forEach(callback) {
|
|
231
|
+
let x = this.start;
|
|
232
|
+
const step = this.step;
|
|
233
|
+
const end = this.end;
|
|
234
|
+
let i = 0;
|
|
235
|
+
if (step > 0) {
|
|
236
|
+
while (x < end) {
|
|
237
|
+
callback(x, [i], this);
|
|
238
|
+
x += step;
|
|
239
|
+
i++;
|
|
240
|
+
}
|
|
241
|
+
} else if (step < 0) {
|
|
242
|
+
while (x > end) {
|
|
243
|
+
callback(x, [i], this);
|
|
244
|
+
x += step;
|
|
245
|
+
i++;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Execute a callback function for each value in the Range, and return the
|
|
251
|
+
* results as an array
|
|
252
|
+
* @memberof Range
|
|
253
|
+
* @param {function} callback The callback method is invoked with three
|
|
254
|
+
* parameters: the value of the element, the index
|
|
255
|
+
* of the element, and the Matrix being traversed.
|
|
256
|
+
* @returns {Array} array
|
|
257
|
+
*/
|
|
258
|
+
map(callback) {
|
|
259
|
+
const array = [];
|
|
260
|
+
this.forEach((value, index) => {
|
|
261
|
+
array[index[0]] = callback(value, index, this);
|
|
262
|
+
});
|
|
263
|
+
return array;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Create an Array with a copy of the Ranges data
|
|
267
|
+
* @memberof Range
|
|
268
|
+
* @returns {Array} array
|
|
269
|
+
*/
|
|
270
|
+
toArray() {
|
|
271
|
+
const array = [];
|
|
272
|
+
this.forEach(function(value, index) {
|
|
273
|
+
array[index[0]] = value;
|
|
274
|
+
});
|
|
275
|
+
return array;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Get the primitive value of the Range, a one dimensional array
|
|
279
|
+
* @memberof Range
|
|
280
|
+
* @returns {Array} array
|
|
281
|
+
*/
|
|
282
|
+
valueOf() {
|
|
283
|
+
if (this.#cache !== null && this.start === this.#cacheStart && this.end === this.#cacheEnd && this.step === this.#cacheStep) {
|
|
284
|
+
return this.#cache;
|
|
285
|
+
}
|
|
286
|
+
this.#cache = this.toArray();
|
|
287
|
+
this.#cacheStart = this.start;
|
|
288
|
+
this.#cacheEnd = this.end;
|
|
289
|
+
this.#cacheStep = this.step;
|
|
290
|
+
return this.#cache;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Get a string representation of the range, with optional formatting options.
|
|
294
|
+
* Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'
|
|
295
|
+
* @memberof Range
|
|
296
|
+
* @param {Object | number | function} [options] Formatting options. See
|
|
297
|
+
* lib/utils/number:format for a
|
|
298
|
+
* description of the available
|
|
299
|
+
* options.
|
|
300
|
+
* @returns {string} str
|
|
301
|
+
*/
|
|
302
|
+
format(options) {
|
|
303
|
+
let str = format(this.start, options);
|
|
304
|
+
if (this.step !== 1) {
|
|
305
|
+
str += ":" + format(this.step, options);
|
|
306
|
+
}
|
|
307
|
+
str += ":" + format(this.end, options);
|
|
308
|
+
return str;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Get a string representation of the range.
|
|
312
|
+
* @memberof Range
|
|
313
|
+
* @returns {string}
|
|
314
|
+
*/
|
|
315
|
+
toString() {
|
|
316
|
+
return this.format();
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Get a JSON representation of the range
|
|
320
|
+
* @memberof Range
|
|
321
|
+
* @returns {Object} Returns a JSON object structured as:
|
|
322
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
323
|
+
*/
|
|
324
|
+
toJSON() {
|
|
325
|
+
return {
|
|
326
|
+
mathjs: "Range",
|
|
327
|
+
start: this.start,
|
|
328
|
+
end: this.end,
|
|
329
|
+
step: this.step
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Instantiate a Range from a JSON object
|
|
334
|
+
* @memberof Range
|
|
335
|
+
* @param {Object} json A JSON object structured as:
|
|
336
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
337
|
+
* @return {Range}
|
|
338
|
+
*/
|
|
339
|
+
static fromJSON(json) {
|
|
340
|
+
return new Range2(json.start, json.end, json.step);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return Range2;
|
|
344
|
+
},
|
|
345
|
+
{ isClass: true }
|
|
346
|
+
);
|
|
347
|
+
var Range = createRangeClass({});
|
|
42
348
|
|
|
43
349
|
// src/types/dual-rules.ts
|
|
44
350
|
var DUAL_UNARY_RULES = {
|
|
@@ -325,8 +631,8 @@ var UNIT_ALIASES = {
|
|
|
325
631
|
"\xB0": "deg"
|
|
326
632
|
// The Unicode micro sign is handled in prefixes; °K is non-standard.
|
|
327
633
|
};
|
|
328
|
-
function getUnitDef(
|
|
329
|
-
return ALL_UNITS[
|
|
634
|
+
function getUnitDef(name2) {
|
|
635
|
+
return ALL_UNITS[name2];
|
|
330
636
|
}
|
|
331
637
|
|
|
332
638
|
// src/types/unit-prefixes.ts
|
|
@@ -395,8 +701,8 @@ var BEST_PREFIXES = [
|
|
|
395
701
|
"z",
|
|
396
702
|
"y"
|
|
397
703
|
];
|
|
398
|
-
function getPrefix(
|
|
399
|
-
return SI_PREFIXES[
|
|
704
|
+
function getPrefix(name2) {
|
|
705
|
+
return SI_PREFIXES[name2];
|
|
400
706
|
}
|
|
401
707
|
|
|
402
708
|
// src/typed/mathts-typed.ts
|
|
@@ -422,7 +728,7 @@ function isTypedWasmAvailable() {
|
|
|
422
728
|
var isNumber = (x) => typeof x === "number";
|
|
423
729
|
var isBoolean = (x) => typeof x === "boolean";
|
|
424
730
|
var isString = (x) => typeof x === "string";
|
|
425
|
-
var
|
|
731
|
+
var isBigInt2 = (x) => typeof x === "bigint";
|
|
426
732
|
var isArray = (x) => Array.isArray(x);
|
|
427
733
|
var isFunction = (x) => typeof x === "function";
|
|
428
734
|
var isObject = (x) => typeof x === "object" && x !== null && !Array.isArray(x);
|
|
@@ -435,7 +741,7 @@ var isUint32Array = (x) => x instanceof Uint32Array;
|
|
|
435
741
|
var isUint8Array = (x) => x instanceof Uint8Array;
|
|
436
742
|
var isComplex2 = (x) => isComplex(x);
|
|
437
743
|
var isFraction2 = (x) => isFraction(x);
|
|
438
|
-
var
|
|
744
|
+
var isBigNumber3 = (x) => isBigNumber2(x);
|
|
439
745
|
var isMatrix = (x) => isObject(x) && "rows" in x && "cols" in x && "get" in x && typeof x.type === "string";
|
|
440
746
|
var isDenseMatrix = (x) => isMatrix(x) && x.type === "DenseMatrix";
|
|
441
747
|
var isSparseMatrix = (x) => isMatrix(x) && x.type === "SparseMatrix";
|
|
@@ -449,12 +755,12 @@ var isUnit2 = (x) => {
|
|
|
449
755
|
};
|
|
450
756
|
var MATHTS_TYPES = [
|
|
451
757
|
// bigint is not built into typed-function
|
|
452
|
-
{ name: "bigint", test:
|
|
758
|
+
{ name: "bigint", test: isBigInt2 },
|
|
453
759
|
// MathTS numeric types (ordered by specificity for conversion priority)
|
|
454
760
|
// WASM masks use typed.masks.OBJECT | typed.masks.custom(N) pattern
|
|
455
761
|
{ name: "Complex", test: isComplex2 },
|
|
456
762
|
{ name: "Fraction", test: isFraction2 },
|
|
457
|
-
{ name: "BigNumber", test:
|
|
763
|
+
{ name: "BigNumber", test: isBigNumber3 },
|
|
458
764
|
// TypedArrays (for parallel-first WASM operations)
|
|
459
765
|
{ name: "Float64Array", test: isFloat64Array },
|
|
460
766
|
{ name: "Float32Array", test: isFloat32Array },
|
|
@@ -649,8 +955,8 @@ var TypeRegistry = class {
|
|
|
649
955
|
/**
|
|
650
956
|
* Register a new type
|
|
651
957
|
*/
|
|
652
|
-
registerType(
|
|
653
|
-
this.types.set(
|
|
958
|
+
registerType(name2, test) {
|
|
959
|
+
this.types.set(name2, { name: name2, test });
|
|
654
960
|
this.instance = null;
|
|
655
961
|
return this;
|
|
656
962
|
}
|
|
@@ -670,8 +976,8 @@ var TypeRegistry = class {
|
|
|
670
976
|
/**
|
|
671
977
|
* Check if a type is registered
|
|
672
978
|
*/
|
|
673
|
-
hasType(
|
|
674
|
-
return this.types.has(
|
|
979
|
+
hasType(name2) {
|
|
980
|
+
return this.types.has(name2);
|
|
675
981
|
}
|
|
676
982
|
/**
|
|
677
983
|
* Check if a conversion is registered
|
|
@@ -706,8 +1012,8 @@ var TypeRegistry = class {
|
|
|
706
1012
|
this.instance = null;
|
|
707
1013
|
}
|
|
708
1014
|
};
|
|
709
|
-
function createTypedFunction(
|
|
710
|
-
return typedInstance(
|
|
1015
|
+
function createTypedFunction(name2, signatures, typedInstance = mathTyped) {
|
|
1016
|
+
return typedInstance(name2, signatures);
|
|
711
1017
|
}
|
|
712
1018
|
|
|
713
1019
|
// src/typed/type-bridge.ts
|
|
@@ -792,50 +1098,50 @@ var FunctionRegistry = class {
|
|
|
792
1098
|
/**
|
|
793
1099
|
* Register a factory function
|
|
794
1100
|
*/
|
|
795
|
-
register(
|
|
796
|
-
this.factories.set(
|
|
1101
|
+
register(factory2) {
|
|
1102
|
+
this.factories.set(factory2.name, factory2);
|
|
797
1103
|
}
|
|
798
1104
|
/**
|
|
799
1105
|
* Register multiple factory functions
|
|
800
1106
|
*/
|
|
801
1107
|
registerAll(factories) {
|
|
802
|
-
for (const
|
|
803
|
-
this.register(
|
|
1108
|
+
for (const factory2 of factories) {
|
|
1109
|
+
this.register(factory2);
|
|
804
1110
|
}
|
|
805
1111
|
}
|
|
806
1112
|
/**
|
|
807
1113
|
* Get or create a function by name
|
|
808
1114
|
*/
|
|
809
|
-
get(
|
|
810
|
-
const existing = this.instances.get(
|
|
1115
|
+
get(name2) {
|
|
1116
|
+
const existing = this.instances.get(name2);
|
|
811
1117
|
if (existing) return existing;
|
|
812
|
-
if (this.creating.has(
|
|
813
|
-
throw new Error(`Circular dependency detected: ${
|
|
1118
|
+
if (this.creating.has(name2)) {
|
|
1119
|
+
throw new Error(`Circular dependency detected: ${name2}`);
|
|
814
1120
|
}
|
|
815
|
-
const
|
|
816
|
-
if (!
|
|
817
|
-
throw new Error(`Unknown function: ${
|
|
1121
|
+
const factory2 = this.factories.get(name2);
|
|
1122
|
+
if (!factory2) {
|
|
1123
|
+
throw new Error(`Unknown function: ${name2}`);
|
|
818
1124
|
}
|
|
819
|
-
this.creating.add(
|
|
1125
|
+
this.creating.add(name2);
|
|
820
1126
|
try {
|
|
821
1127
|
const deps = { ...this.dependencies };
|
|
822
|
-
for (const depName of
|
|
1128
|
+
for (const depName of factory2.dependencies) {
|
|
823
1129
|
if (depName === "config" || depName === "typed") continue;
|
|
824
1130
|
deps[depName] = this.get(depName);
|
|
825
1131
|
}
|
|
826
|
-
const fn =
|
|
827
|
-
this.instances.set(
|
|
828
|
-
this.dependencies[
|
|
1132
|
+
const fn = factory2.factory(deps);
|
|
1133
|
+
this.instances.set(name2, fn);
|
|
1134
|
+
this.dependencies[name2] = fn;
|
|
829
1135
|
return fn;
|
|
830
1136
|
} finally {
|
|
831
|
-
this.creating.delete(
|
|
1137
|
+
this.creating.delete(name2);
|
|
832
1138
|
}
|
|
833
1139
|
}
|
|
834
1140
|
/**
|
|
835
1141
|
* Check if a function is registered
|
|
836
1142
|
*/
|
|
837
|
-
has(
|
|
838
|
-
return this.factories.has(
|
|
1143
|
+
has(name2) {
|
|
1144
|
+
return this.factories.has(name2);
|
|
839
1145
|
}
|
|
840
1146
|
/**
|
|
841
1147
|
* Get all registered function names
|
|
@@ -857,19 +1163,19 @@ var FunctionRegistry = class {
|
|
|
857
1163
|
return { ...this.dependencies.config };
|
|
858
1164
|
}
|
|
859
1165
|
};
|
|
860
|
-
function createFactory(
|
|
861
|
-
return { name, dependencies, factory };
|
|
1166
|
+
function createFactory(name2, dependencies2, factory2) {
|
|
1167
|
+
return { name: name2, dependencies: dependencies2, factory: factory2 };
|
|
862
1168
|
}
|
|
863
1169
|
var registry = new FunctionRegistry();
|
|
864
1170
|
var math = {
|
|
865
1171
|
/**
|
|
866
1172
|
* Get a registered function
|
|
867
1173
|
*/
|
|
868
|
-
get: (
|
|
1174
|
+
get: (name2) => registry.get(name2),
|
|
869
1175
|
/**
|
|
870
1176
|
* Register a factory function
|
|
871
1177
|
*/
|
|
872
|
-
register: (
|
|
1178
|
+
register: (factory2) => registry.register(factory2),
|
|
873
1179
|
/**
|
|
874
1180
|
* Get configuration
|
|
875
1181
|
*/
|
|
@@ -923,6 +1229,7 @@ export {
|
|
|
923
1229
|
MATHTS_TYPES,
|
|
924
1230
|
PHI,
|
|
925
1231
|
PI,
|
|
1232
|
+
Range,
|
|
926
1233
|
SI_PREFIXES,
|
|
927
1234
|
SQRT1_2,
|
|
928
1235
|
SQRT2,
|
|
@@ -937,6 +1244,7 @@ export {
|
|
|
937
1244
|
create,
|
|
938
1245
|
createFactory,
|
|
939
1246
|
createMathTSTyped,
|
|
1247
|
+
createRangeClass,
|
|
940
1248
|
createTypedFunction,
|
|
941
1249
|
dim,
|
|
942
1250
|
divideScalar,
|
|
@@ -946,8 +1254,8 @@ export {
|
|
|
946
1254
|
getUnitDef,
|
|
947
1255
|
initTypedWasm,
|
|
948
1256
|
isArray,
|
|
949
|
-
isBigInt,
|
|
950
|
-
isBigNumber,
|
|
1257
|
+
isBigInt2 as isBigInt,
|
|
1258
|
+
isBigNumber2 as isBigNumber,
|
|
951
1259
|
isBoolean,
|
|
952
1260
|
isComplex,
|
|
953
1261
|
isDenseMatrix,
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,33 +1,5 @@
|
|
|
1
|
-
import { b as UnitConstructor, c as UnitDependencies } from './index-
|
|
2
|
-
export { B as BaseUnitDef, d as BigNumber, e as BigNumberConstructor, f as BigNumberValue, C as Complex, g as ComplexConstructor, h as ComplexValue, j as ConverterFn, U as CoreUnit, k as CreateUnitDefObject, l as CreateUnitOptions, D as DenseMatrix,
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Type for a factory function that creates instances
|
|
6
|
-
*/
|
|
7
|
-
interface FactoryFunction<TResult = unknown> {
|
|
8
|
-
(scope: Record<string, unknown>): TResult;
|
|
9
|
-
isFactory: true;
|
|
10
|
-
fn: string;
|
|
11
|
-
dependencies: string[];
|
|
12
|
-
meta?: FactoryMeta;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Meta information that can be attached to a factory
|
|
16
|
-
*/
|
|
17
|
-
interface FactoryMeta {
|
|
18
|
-
/**
|
|
19
|
-
* If true, the factory will be recreated when config changes
|
|
20
|
-
*/
|
|
21
|
-
recreateOnConfigChange?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* If true, this is a lazy factory that should only be created when needed
|
|
24
|
-
*/
|
|
25
|
-
lazy?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Additional custom metadata
|
|
28
|
-
*/
|
|
29
|
-
[key: string]: unknown;
|
|
30
|
-
}
|
|
1
|
+
import { F as FactoryFunction, b as UnitConstructor, c as UnitDependencies } from './index-zKEDY9aj.js';
|
|
2
|
+
export { B as BaseUnitDef, d as BigNumber, e as BigNumberConstructor, f as BigNumberValue, C as Complex, g as ComplexConstructor, h as ComplexValue, j as ConverterFn, U as CoreUnit, k as CreateUnitDefObject, l as CreateUnitOptions, D as DenseMatrix, m as Fraction, n as FractionConstructor, o as FractionValue, I as Index, p as IndexDimension, M as Matrix, N as Numeric, P as ParseOptions, q as PrefixDef, r as PrefixTable, R as Range, S as ScalarBinaryOp, s as ScalarUnaryOp, t as SparseMatrix, u as SubtractScalar, T as TypeConverters, v as Unit, w as UnitComponent, x as UnitConfig, y as UnitDef, z as UnitFormatOptions, a as UnitInstance, A as UnitJSON, E as UnitSystem, G as UnitSystemEntry, H as isArray, J as isBigInt, K as isBigNumber, L as isBoolean, O as isCollection, Q as isComplex, V as isDate, W as isDenseMatrix, X as isFraction, Y as isFunction, Z as isIndex, _ as isMap, $ as isMatrix, a0 as isNull, a1 as isNumber, a2 as isObject, a3 as isRange, a4 as isRegExp, a5 as isSparseMatrix, a6 as isString, a7 as isUndefined, i as isUnit, a8 as typeOf } from './index-zKEDY9aj.js';
|
|
31
3
|
|
|
32
4
|
declare const createUnitClass: FactoryFunction<UnitConstructor>;
|
|
33
5
|
|
package/dist/internal.js
CHANGED
|
@@ -21,13 +21,13 @@ import {
|
|
|
21
21
|
hasOwnProperty,
|
|
22
22
|
isArray,
|
|
23
23
|
isBigInt,
|
|
24
|
-
|
|
24
|
+
isBigNumber,
|
|
25
25
|
isBoolean,
|
|
26
26
|
isCollection,
|
|
27
27
|
isComplex2 as isComplex,
|
|
28
28
|
isDate,
|
|
29
29
|
isDenseMatrix,
|
|
30
|
-
|
|
30
|
+
isFraction,
|
|
31
31
|
isFunction,
|
|
32
32
|
isIndex,
|
|
33
33
|
isInteger,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
typeOf,
|
|
70
70
|
unitDependencies,
|
|
71
71
|
warnOnce
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-AMOHH5MP.js";
|
|
73
73
|
export {
|
|
74
74
|
Unit as CoreUnit,
|
|
75
75
|
acosh,
|