@danielsimonjr/mathts-core 0.15.0 → 0.15.2

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/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
- // @ts-expect-error: Implementation is compatible but TS can't infer it
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
- // @ts-expect-error: Implementation is compatible but TS can't infer it
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
  }
package/dist/is.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Shape of a BigNumber value that the duck-typing guards in this module read.
3
+ */
1
4
  export interface BigNumber {
2
5
  isBigNumber: boolean;
3
6
  constructor: {
@@ -7,14 +10,23 @@ export interface BigNumber {
7
10
  isDecimal?: (x: unknown) => boolean;
8
11
  };
9
12
  }
13
+ /**
14
+ * Shape of a complex number: real part `re` and imaginary part `im`.
15
+ */
10
16
  export interface Complex {
11
17
  re: number;
12
18
  im: number;
13
19
  }
20
+ /**
21
+ * Shape of a fraction: numerator `n` and denominator `d`.
22
+ */
14
23
  export interface Fraction {
15
24
  n: number;
16
25
  d: number;
17
26
  }
27
+ /**
28
+ * Shape of a Unit value that the duck-typing guards in this module read.
29
+ */
18
30
  export interface Unit {
19
31
  constructor: {
20
32
  prototype: {
@@ -22,6 +34,9 @@ export interface Unit {
22
34
  };
23
35
  };
24
36
  }
37
+ /**
38
+ * Shape of a Matrix value that the duck-typing guards in this module read.
39
+ */
25
40
  export interface Matrix {
26
41
  isMatrix?: boolean;
27
42
  _size?: number[];
@@ -31,12 +46,21 @@ export interface Matrix {
31
46
  };
32
47
  };
33
48
  }
49
+ /**
50
+ * Shape of a Matrix that also has the `isDenseMatrix` flag.
51
+ */
34
52
  export interface DenseMatrix extends Matrix {
35
53
  isDenseMatrix: boolean;
36
54
  }
55
+ /**
56
+ * Shape of a Matrix that also has the `isSparseMatrix` flag.
57
+ */
37
58
  export interface SparseMatrix extends Matrix {
38
59
  isSparseMatrix: boolean;
39
60
  }
61
+ /**
62
+ * Shape of a Range value: start, end and step.
63
+ */
40
64
  export interface Range {
41
65
  start: number;
42
66
  end: number;
@@ -47,6 +71,9 @@ export interface Range {
47
71
  };
48
72
  };
49
73
  }
74
+ /**
75
+ * Shape of one dimension of an Index.
76
+ */
50
77
  export interface IndexDimension {
51
78
  _data?: unknown[];
52
79
  _size: number[];
@@ -54,6 +81,9 @@ export interface IndexDimension {
54
81
  start?: number;
55
82
  end?: number;
56
83
  }
84
+ /**
85
+ * Shape of an Index value: its dimensions and the optional source size.
86
+ */
57
87
  export interface Index {
58
88
  _dimensions: (IndexDimension | string)[];
59
89
  _sourceSize?: (number | null)[];
@@ -63,40 +93,164 @@ export interface Index {
63
93
  };
64
94
  };
65
95
  }
96
+ /**
97
+ * Test whether a value is a primitive number.
98
+ *
99
+ * @param x - The value to test.
100
+ * @returns True when `typeof x` is `'number'`.
101
+ */
66
102
  export declare function isNumber(x: unknown): x is number;
103
+ /**
104
+ * Test whether a value is a BigNumber.
105
+ *
106
+ * @param x - The value to test.
107
+ * @returns True when `x` and its constructor prototype both have `isBigNumber === true`, or when `x.constructor.isDecimal(x)` returns true.
108
+ */
67
109
  export declare function isBigNumber(x: unknown): x is BigNumber;
110
+ /**
111
+ * Test whether a value is a primitive bigint.
112
+ *
113
+ * @param x - The value to test.
114
+ * @returns True when `typeof x` is `'bigint'`.
115
+ */
68
116
  export declare function isBigInt(x: unknown): x is bigint;
117
+ /**
118
+ * Test whether a value is a Complex number.
119
+ *
120
+ * @param x - The value to test.
121
+ * @returns True when `x` is an object whose prototype has `isComplex === true`.
122
+ */
69
123
  export declare function isComplex(x: unknown): x is Complex;
124
+ /**
125
+ * Test whether a value is a Fraction.
126
+ *
127
+ * @param x - The value to test.
128
+ * @returns True when `x` is an object whose prototype has `isFraction === true`.
129
+ */
70
130
  export declare function isFraction(x: unknown): x is Fraction;
131
+ /**
132
+ * Test whether a value is a Unit.
133
+ *
134
+ * @param x - The value to test.
135
+ * @returns True when the constructor prototype of `x` has `isUnit === true`.
136
+ */
71
137
  export declare function isUnit(x: unknown): x is Unit;
138
+ /**
139
+ * Test whether a value is a primitive string.
140
+ *
141
+ * @param x - The value to test.
142
+ * @returns True when `typeof x` is `'string'`.
143
+ */
72
144
  export declare function isString(x: unknown): x is string;
73
145
  export declare const isArray: (arg: any) => arg is any[];
146
+ /**
147
+ * Test whether a value is a Matrix of any storage type.
148
+ *
149
+ * @param x - The value to test.
150
+ * @returns True when the constructor prototype of `x` has `isMatrix === true`.
151
+ */
74
152
  export declare function isMatrix(x: unknown): x is Matrix;
75
153
  /**
76
154
  * Test whether a value is a collection: an Array or Matrix
77
- * @param {*} x
78
- * @returns {boolean} isCollection
155
+ * @param x
156
+ * @returns isCollection
79
157
  */
80
158
  export declare function isCollection(x: unknown): x is unknown[] | Matrix;
159
+ /**
160
+ * Test whether a value is a DenseMatrix.
161
+ *
162
+ * @param x - The value to test.
163
+ * @returns True when `x` has `isDenseMatrix === true` and its constructor prototype has `isMatrix === true`.
164
+ */
81
165
  export declare function isDenseMatrix(x: unknown): x is DenseMatrix;
166
+ /**
167
+ * Test whether a value is a SparseMatrix.
168
+ *
169
+ * @param x - The value to test.
170
+ * @returns True when `x` has `isSparseMatrix === true` and its constructor prototype has `isMatrix === true`.
171
+ */
82
172
  export declare function isSparseMatrix(x: unknown): x is SparseMatrix;
173
+ /**
174
+ * Test whether a value is a Range.
175
+ *
176
+ * @param x - The value to test.
177
+ * @returns True when the constructor prototype of `x` has `isRange === true`.
178
+ */
83
179
  export declare function isRange(x: unknown): x is Range;
180
+ /**
181
+ * Test whether a value is an Index.
182
+ *
183
+ * @param x - The value to test.
184
+ * @returns True when the constructor prototype of `x` has `isIndex === true`.
185
+ */
84
186
  export declare function isIndex(x: unknown): x is Index;
187
+ /**
188
+ * Test whether a value is a primitive boolean.
189
+ *
190
+ * @param x - The value to test.
191
+ * @returns True when `typeof x` is `'boolean'`.
192
+ */
85
193
  export declare function isBoolean(x: unknown): x is boolean;
194
+ /**
195
+ * Test whether a value is a function.
196
+ *
197
+ * @param x - The value to test.
198
+ * @returns True when `typeof x` is `'function'`.
199
+ */
86
200
  export declare function isFunction(x: unknown): x is (...args: unknown[]) => unknown;
201
+ /**
202
+ * Test whether a value is a Date.
203
+ *
204
+ * @param x - The value to test.
205
+ * @returns True when `x` is an `instanceof Date`.
206
+ */
87
207
  export declare function isDate(x: unknown): x is Date;
208
+ /**
209
+ * Test whether a value is a regular expression.
210
+ *
211
+ * @param x - The value to test.
212
+ * @returns True when `x` is an `instanceof RegExp`.
213
+ */
88
214
  export declare function isRegExp(x: unknown): x is RegExp;
215
+ /**
216
+ * Test whether a value is a plain object.
217
+ *
218
+ * @param x - The value to test.
219
+ * @returns True when the constructor of `x` is `Object` and `x` is not a Complex or a Fraction.
220
+ */
89
221
  export declare function isObject(x: unknown): x is Record<string, unknown>;
90
222
  /**
91
223
  * Returns `true` if the passed object appears to be a Map (i.e. duck typing).
92
224
  *
93
225
  * Methods looked for are `get`, `set`, `keys` and `has`.
94
226
  *
95
- * @param {Map | object} object
227
+ * @param object
96
228
  * @returns
97
229
  */
98
230
  export declare function isMap(object: unknown): object is Map<unknown, unknown>;
231
+ /**
232
+ * Test whether a value is null.
233
+ *
234
+ * @param x - The value to test.
235
+ * @returns True when `x === null`.
236
+ */
99
237
  export declare function isNull(x: unknown): x is null;
238
+ /**
239
+ * Test whether a value is undefined.
240
+ *
241
+ * @param x - The value to test.
242
+ * @returns True when `x === undefined`.
243
+ */
100
244
  export declare function isUndefined(x: unknown): x is undefined;
245
+ /**
246
+ * Get the type name of a value.
247
+ *
248
+ * For an object, the result is `'null'`, `'BigNumber'`, `'Complex'`, `'Fraction'`,
249
+ * the constructor name, or `'Object'`, in that order of test.
250
+ * For other values, the result is the `typeof` string.
251
+ *
252
+ * @param x - The value to examine.
253
+ * @returns The type name.
254
+ */
101
255
  export declare function typeOf(x: unknown): string;
102
256
  //# sourceMappingURL=is.d.ts.map
package/dist/is.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"is.d.ts","sourceRoot":"","sources":["../src/is.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE;QACX,SAAS,EAAE;YAAE,WAAW,EAAE,OAAO,CAAA;SAAE,CAAC;QACpC,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;KACrC,CAAC;CACH;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,QAAQ;IACvB,CAA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;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,IAAI,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAEhD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQjE;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CActE;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,IAAI,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,SAAS,CAEtD;AAED;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAmBzC"}
package/dist/map.d.ts CHANGED
@@ -13,6 +13,18 @@
13
13
  * Deriving it keeps `implements Map<K, V>` honest on every TS version.
14
14
  */
15
15
  type MapEntryIterator<K, V> = ReturnType<Map<K, V>[typeof Symbol.iterator]>;
16
+ /** The iterator type `Map.prototype.keys` declares, derived like `MapEntryIterator`. */
17
+ type MapKeyIterator<K, V> = ReturnType<Map<K, V>['keys']>;
18
+ /** The iterator type `Map.prototype.values` declares, derived like `MapEntryIterator`. */
19
+ type MapValueIterator<K, V> = ReturnType<Map<K, V>['values']>;
20
+ /** The iterator type `Map.prototype.entries` declares, derived like `MapEntryIterator`. */
21
+ type MapEntriesIterator<K, V> = ReturnType<Map<K, V>['entries']>;
22
+ /**
23
+ * A Map view of a plain object.
24
+ *
25
+ * The map does not copy the object. Reads use `getSafeProperty` and writes use
26
+ * `setSafeProperty` on the wrapped object.
27
+ */
16
28
  export declare class ObjectWrappingMap<K = string, V = unknown> implements Map<K, V> {
17
29
  wrappedObject: Record<string, V>;
18
30
  readonly [Symbol.toStringTag]: string;
@@ -25,12 +37,22 @@ export declare class ObjectWrappingMap<K = string, V = unknown> implements Map<K
25
37
  * implements interface 'Map'... '[Symbol.iterator]' is missing").
26
38
  */
27
39
  [Symbol.iterator](): MapEntryIterator<K, V>;
28
- keys(): IterableIterator<K>;
40
+ keys(): MapKeyIterator<K, V>;
29
41
  get(key: K): V | undefined;
30
42
  set(key: K, value: V): this;
31
43
  has(key: K): boolean;
32
- entries(): IterableIterator<[K, V]>;
33
- values(): IterableIterator<V>;
44
+ /**
45
+ * Return the value for `key`; when the key is absent, set it to `defaultValue` first.
46
+ * Declared because the ESNext `Map` (TC39 upsert) has it, and `implements Map` requires it.
47
+ */
48
+ getOrInsert(key: K, defaultValue: V): V;
49
+ /**
50
+ * Return the value for `key`; when the key is absent, set it to `callback(key)` first.
51
+ * Declared because the ESNext `Map` (TC39 upsert) has it, and `implements Map` requires it.
52
+ */
53
+ getOrInsertComputed(key: K, callback: (key: K) => V): V;
54
+ entries(): MapEntriesIterator<K, V>;
55
+ values(): MapValueIterator<K, V>;
34
56
  forEach(callback: (value: V, key: K, map: Map<K, V>) => void): void;
35
57
  delete(key: K): boolean;
36
58
  clear(): void;
@@ -56,6 +78,8 @@ export declare class PartitionedMap<K = unknown, V = unknown> implements Map<K,
56
78
  bKeys: Set<K>;
57
79
  readonly [Symbol.toStringTag]: string;
58
80
  /**
81
+ * Create a PartitionedMap over two maps.
82
+ *
59
83
  * @param a - Primary map
60
84
  * @param b - Secondary map
61
85
  * @param bKeys - Set of keys that should be read/written to map b
@@ -66,9 +90,19 @@ export declare class PartitionedMap<K = unknown, V = unknown> implements Map<K,
66
90
  get(key: K): V | undefined;
67
91
  set(key: K, value: V): this;
68
92
  has(key: K): boolean;
69
- keys(): IterableIterator<K>;
70
- values(): IterableIterator<V>;
71
- entries(): IterableIterator<[K, V]>;
93
+ /**
94
+ * Return the value for `key`; when the key is absent, set it to `defaultValue` first.
95
+ * Declared because the ESNext `Map` (TC39 upsert) has it, and `implements Map` requires it.
96
+ */
97
+ getOrInsert(key: K, defaultValue: V): V;
98
+ /**
99
+ * Return the value for `key`; when the key is absent, set it to `callback(key)` first.
100
+ * Declared because the ESNext `Map` (TC39 upsert) has it, and `implements Map` requires it.
101
+ */
102
+ getOrInsertComputed(key: K, callback: (key: K) => V): V;
103
+ keys(): MapKeyIterator<K, V>;
104
+ values(): MapValueIterator<K, V>;
105
+ entries(): MapEntriesIterator<K, V>;
72
106
  forEach(callback: (value: V, key: K, map: Map<K, V>) => void): void;
73
107
  delete(key: K): boolean;
74
108
  clear(): void;
package/dist/map.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":"AAmCA;;;;;;;GAOG;AACH;;;;;GAKG;AACH,KAAK,gBAAgB,CAAC,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE5E,qBAAa,iBAAiB,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,OAAO,CAAE,YAAW,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1E,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACjC,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAAuB;IAE5D,YAAY,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EAEpC;IAED;;;;;;OAMG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAE1C;IAGD,IAAI,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAI1B;IAED,GAAG,CAAC,GAAG,EAAE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AAiB,CAIhF"}
package/dist/object.d.ts CHANGED
@@ -7,66 +7,66 @@ import { hasOwnProperty } from './shared.js';
7
7
  * Can clone any primitive type, array, and object.
8
8
  * If x has a function clone, this function will be invoked to clone the object.
9
9
  *
10
- * @param {*} x
11
- * @return {*} clone
10
+ * @param x
11
+ * @return clone
12
12
  */
13
13
  export declare function clone<T>(x: T): T;
14
14
  /**
15
15
  * Apply map to all properties of an object
16
- * @param {Object} object
17
- * @param {function} callback
18
- * @return {Object} Returns a copy of the object with mapped properties
16
+ * @param object
17
+ * @param callback
18
+ * @return Returns a copy of the object with mapped properties
19
19
  */
20
20
  export declare function mapObject<T, U>(object: Record<string, T>, callback: (value: T) => U): Record<string, U>;
21
21
  /**
22
22
  * Extend object a with the properties of object b
23
- * @param {Object} a
24
- * @param {Object} b
25
- * @return {Object} a
23
+ * @param a
24
+ * @param b
25
+ * @return a
26
26
  */
27
27
  export declare function extend<T extends Record<string, unknown>, U extends Record<string, unknown>>(a: T, b: U): T & U;
28
28
  /**
29
29
  * Deep extend an object a with the properties of object b
30
- * @param {Object} a
31
- * @param {Object} b
32
- * @returns {Object}
30
+ * @param a
31
+ * @param b
32
+ * @returns
33
33
  */
34
34
  export declare function deepExtend<T>(a: T, b: unknown): T;
35
35
  /**
36
36
  * Deep test equality of all fields in two pairs of arrays or objects.
37
37
  * Compares values and functions strictly (ie. 2 is not the same as '2').
38
- * @param {Array | Object} a
39
- * @param {Array | Object} b
40
- * @returns {boolean}
38
+ * @param a
39
+ * @param b
40
+ * @returns
41
41
  */
42
42
  export declare function deepStrictEqual(a: unknown, b: unknown): boolean;
43
43
  /**
44
44
  * Recursively flatten a nested object.
45
- * @param {Object} nestedObject
46
- * @return {Object} Returns the flattened object
45
+ * @param nestedObject
46
+ * @return Returns the flattened object
47
47
  */
48
48
  export declare function deepFlatten(nestedObject: Record<string, unknown>): Record<string, unknown>;
49
49
  /**
50
50
  * Test whether the current JavaScript engine supports Object.defineProperty
51
- * @returns {boolean} returns true if supported
51
+ * @returns returns true if supported
52
52
  */
53
53
  export declare function canDefineProperty(): boolean;
54
54
  /**
55
55
  * Attach a lazy loading property to a constant.
56
56
  * The given function `fn` is called once when the property is first requested.
57
57
  *
58
- * @param {Object} object Object where to add the property
59
- * @param {string} prop Property name
60
- * @param {Function} valueResolver Function returning the property value. Called
58
+ * @param object - Object where to add the property
59
+ * @param prop - Property name
60
+ * @param valueResolver - Function returning the property value. Called
61
61
  * without arguments.
62
62
  */
63
63
  export declare function lazy<T>(object: Record<string, unknown>, prop: string, valueResolver: () => T): void;
64
64
  /**
65
65
  * Traverse a path into an object.
66
66
  * When a namespace is missing, it will be created
67
- * @param {Object} object
68
- * @param {string | string[]} path A dot separated string like 'name.space'
69
- * @return {Object} Returns the object at the end of the path
67
+ * @param object
68
+ * @param path - A dot separated string like 'name.space'
69
+ * @return Returns the object at the end of the path
70
70
  */
71
71
  export declare function traverse(object: Record<string, unknown>, path: string | string[]): Record<string, unknown>;
72
72
  export { hasOwnProperty };
@@ -79,41 +79,41 @@ export { hasOwnProperty };
79
79
  * - math: boolean If true (false by default), the math namespace is passed
80
80
  * as fifth argument of the factory function
81
81
  *
82
- * @param {*} object
83
- * @returns {boolean}
82
+ * @param object
83
+ * @returns
84
84
  */
85
85
  export declare function isLegacyFactory(object: unknown): boolean;
86
86
  /**
87
87
  * Get a nested property from an object
88
- * @param {Object} object
89
- * @param {string | string[]} path
90
- * @returns {Object}
88
+ * @param object
89
+ * @param path
90
+ * @returns
91
91
  */
92
92
  export declare function get(object: Record<string, unknown>, path: string | string[]): unknown;
93
93
  /**
94
94
  * Set a nested property in an object
95
95
  * Mutates the object itself
96
96
  * If the path doesn't exist, it will be created
97
- * @param {Object} object
98
- * @param {string | string[]} path
99
- * @param {*} value
100
- * @returns {Object}
97
+ * @param object
98
+ * @param path
99
+ * @param value
100
+ * @returns
101
101
  */
102
102
  export declare function set<T extends Record<string, unknown>>(object: T, path: string | string[], value: unknown): T;
103
103
  /**
104
104
  * Create an object composed of the picked object properties
105
- * @param {Object} object
106
- * @param {string[]} properties
107
- * @param {function} [transform] Optional value to transform a value when picking it
108
- * @return {Object}
105
+ * @param object
106
+ * @param properties
107
+ * @param transform - Optional value to transform a value when picking it
108
+ * @return
109
109
  */
110
110
  export declare function pick(object: Record<string, unknown>, properties: string[], transform?: (value: unknown, key: string) => unknown): Record<string, unknown>;
111
111
  /**
112
112
  * Shallow version of pick, creating an object composed of the picked object properties
113
113
  * but not for nested properties
114
- * @param {Object} object
115
- * @param {string[]} properties
116
- * @return {Object}
114
+ * @param object
115
+ * @param properties
116
+ * @return
117
117
  */
118
118
  export declare function pickShallow(object: Record<string, unknown>, properties: string[]): Record<string, unknown>;
119
119
  //# sourceMappingURL=object.d.ts.map
package/dist/shared.d.ts CHANGED
@@ -5,8 +5,8 @@
5
5
  */
6
6
  /**
7
7
  * A safe hasOwnProperty
8
- * @param {Object} object
9
- * @param {string} property
8
+ * @param object
9
+ * @param property
10
10
  */
11
11
  export declare function hasOwnProperty(object: unknown, property: string): boolean;
12
12
  /**
package/dist/string.d.ts CHANGED
@@ -37,8 +37,8 @@ export type GeneralFormatOptions = number | ((value: unknown) => string) | (Form
37
37
  * math.format(new Complex(2, 3)) // '2 + 3i'
38
38
  * math.format('hello') // '"hello"'
39
39
  *
40
- * @param {*} value Value to be stringified
41
- * @param {Object | number | Function} [options]
40
+ * @param value - Value to be stringified
41
+ * @param options - Optional.
42
42
  * Formatting options. See src/utils/number.js:format for a
43
43
  * description of the available options controlling number output.
44
44
  * This generic "format" also supports the option property `truncate: NN`
@@ -50,20 +50,20 @@ export declare function format(value: unknown, options?: unknown): string;
50
50
  /**
51
51
  * Stringify a value into a string enclosed in double quotes.
52
52
  * Unescaped double quotes and backslashes inside the value are escaped.
53
- * @param {*} value
53
+ * @param value
54
54
  * @return {string}
55
55
  */
56
56
  export declare function stringify(value: unknown): string;
57
57
  /**
58
58
  * Escape special HTML characters
59
- * @param {*} value
59
+ * @param value
60
60
  * @return {string}
61
61
  */
62
62
  export declare function escape(value: unknown): string;
63
63
  /**
64
64
  * Compare two strings
65
- * @param {string} x
66
- * @param {string} y
65
+ * @param x
66
+ * @param y
67
67
  * @returns {number}
68
68
  */
69
69
  export declare function compareText(x: unknown, y: unknown): number;
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Add duck-typing markers to the prototypes of the native Complex, Fraction and BigNumber classes.
3
+ *
4
+ * The function adds each marker only when the prototype does not have it.
5
+ * The markers are not writable, not enumerable and not configurable.
6
+ * Calls after the first call do nothing.
7
+ */
1
8
  export declare function registerNativeTypes(): void;
2
9
  //# sourceMappingURL=type-bridge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-bridge.d.ts","sourceRoot":"","sources":["../../src/typed/type-bridge.ts"],"names":[],"mappings":"AAeA,wBAAgB,mBAAmB,IAAI,IAAI,CAyD1C"}
1
+ {"version":3,"file":"type-bridge.d.ts","sourceRoot":"","sources":["../../src/typed/type-bridge.ts"],"names":[],"mappings":"AAeA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAyD1C"}
@@ -20,6 +20,9 @@ export interface BigNumberConfig {
20
20
  /** Maximum exponent (default: 1e9) */
21
21
  maxExponent: number;
22
22
  }
23
+ /**
24
+ * Rounding mode of a BigNumber operation. The default configuration uses `'halfUp'`.
25
+ */
23
26
  export type RoundingMode = 'up' | 'down' | 'ceil' | 'floor' | 'halfUp' | 'halfDown' | 'halfEven' | 'halfCeil' | 'halfFloor';
24
27
  /**
25
28
  * BigNumber class for arbitrary precision decimal arithmetic