@pawover/kit 0.0.0-alpha.26 → 0.0.0-alpha.28
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/index.d.ts +702 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -12
- package/dist/index.js.map +1 -1
- package/metadata.json +2 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BigNumber, MathExpression, MathJsInstance, Matrix } from "mathjs";
|
|
2
|
-
import { Class, NonEmptyObject, Replace, SetOptional, UnionToTuple, ValueOf } from "type-fest";
|
|
3
|
-
import { Assign } from "radashi";
|
|
2
|
+
import { Class, NonEmptyObject, Replace, SetOptional, Simplify, UnionToIntersection, UnionToTuple, ValueOf } from "type-fest";
|
|
4
3
|
|
|
5
4
|
//#region src/utils/array/arrayCast.d.ts
|
|
5
|
+
|
|
6
6
|
/**
|
|
7
7
|
* 构造数组
|
|
8
8
|
* @param candidate 待构造项
|
|
@@ -28,7 +28,7 @@ declare function arrayCompete<T>(initialList: readonly T[], match: (a: T, b: T)
|
|
|
28
28
|
* @param initialList 初始数组
|
|
29
29
|
* @param match 匹配函数
|
|
30
30
|
*/
|
|
31
|
-
declare function arrayCounting<T, K extends PropertyKey>(initialList: readonly T[], match: (row: T) => K): Record<string, number>;
|
|
31
|
+
declare function arrayCounting<T, K$1 extends PropertyKey>(initialList: readonly T[], match: (row: T) => K$1): Record<string, number>;
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/utils/array/arrayDifference.d.ts
|
|
34
34
|
/**
|
|
@@ -98,7 +98,7 @@ declare function arrayMerge<T>(initialList: readonly T[], mergeList: readonly T[
|
|
|
98
98
|
* @param filter filter 函数
|
|
99
99
|
* @param mapper map 函数
|
|
100
100
|
*/
|
|
101
|
-
declare function arrayPick<T, K = T>(initialList: readonly T[], filter: (row: T, index: number) => boolean, mapper?: ((row: T, index: number) => K) | undefined): T[] | K[];
|
|
101
|
+
declare function arrayPick<T, K$1 = T>(initialList: readonly T[], filter: (row: T, index: number) => boolean, mapper?: ((row: T, index: number) => K$1) | undefined): T[] | K$1[];
|
|
102
102
|
//#endregion
|
|
103
103
|
//#region src/utils/array/arrayReplace.d.ts
|
|
104
104
|
/**
|
|
@@ -126,7 +126,7 @@ declare function arraySplit<T>(initialList: readonly T[], size?: number): T[][];
|
|
|
126
126
|
* @param promise
|
|
127
127
|
* @param errorExt - 可以传递给err对象的其他信息
|
|
128
128
|
*/
|
|
129
|
-
declare function to<T, U = Error>(promise: Readonly<Promise<T>>, errorExt?: UnknownObject): Promise<[U, undefined] | [null, T]>;
|
|
129
|
+
declare function to<T, U$1 = Error>(promise: Readonly<Promise<T>>, errorExt?: UnknownObject): Promise<[U$1, undefined] | [null, T]>;
|
|
130
130
|
//#endregion
|
|
131
131
|
//#region src/utils/math/toMathBignumber.d.ts
|
|
132
132
|
/**
|
|
@@ -162,7 +162,7 @@ declare function toMathEvaluate(mathJsInstance: MathJsInstance, expr: MathExpres
|
|
|
162
162
|
//#endregion
|
|
163
163
|
//#region src/utils/object/cloneDeep.d.ts
|
|
164
164
|
interface CloningStrategy {
|
|
165
|
-
cloneMap: <K, V>(parent: Map<K, V>, track: (newParent: Map<K, V>) => Map<K, V>, clone: <T>(value: T) => T) => Map<K, V> | null;
|
|
165
|
+
cloneMap: <K$1, V>(parent: Map<K$1, V>, track: (newParent: Map<K$1, V>) => Map<K$1, V>, clone: <T>(value: T) => T) => Map<K$1, V> | null;
|
|
166
166
|
cloneSet: <T>(parent: Set<T>, track: (newParent: Set<T>) => Set<T>, clone: <T>(value: T) => T) => Set<T> | null;
|
|
167
167
|
cloneArray: <T>(parent: readonly T[], track: (newParent: T[]) => T[], clone: <T>(value: T) => T) => T[] | null;
|
|
168
168
|
cloneObject: <T extends AnyObject>(parent: T, track: (newParent: T) => T, clone: <T>(value: T) => T) => T | null;
|
|
@@ -202,7 +202,682 @@ declare function enumTypeCheck<E extends AnyObject>(enumeration: E): E & Record<
|
|
|
202
202
|
declare function enumValues<E extends AnyObject>(enumeration: NonEmptyObject<E>): UnionToTuple<ValueOf<E>>;
|
|
203
203
|
//#endregion
|
|
204
204
|
//#region src/utils/object/mapEntries.d.ts
|
|
205
|
-
declare function mapEntries<K extends PropertyKey, V, NK extends PropertyKey, NV>(obj: UnknownObject<K, V>, toEntry: (key: K, value: V) => [NK, NV]): UnknownObject<NK, NV>;
|
|
205
|
+
declare function mapEntries<K$1 extends PropertyKey, V, NK extends PropertyKey, NV>(obj: UnknownObject<K$1, V>, toEntry: (key: K$1, value: V) => [NK, NV]): UnknownObject<NK, NV>;
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region node_modules/.pnpm/radashi@12.7.1/node_modules/radashi/dist/radashi.d.cts
|
|
208
|
+
|
|
209
|
+
interface BigInt {
|
|
210
|
+
/**
|
|
211
|
+
* Returns a string representation of an object.
|
|
212
|
+
* @param radix Specifies a radix for converting numeric values to strings.
|
|
213
|
+
*/
|
|
214
|
+
toString(radix?: number): string;
|
|
215
|
+
/** Returns a string representation appropriate to the host environment's current locale. */
|
|
216
|
+
toLocaleString(locales?: any, options?: BigIntToLocaleStringOptions): string;
|
|
217
|
+
/** Returns the primitive value of the specified object. */
|
|
218
|
+
valueOf(): bigint;
|
|
219
|
+
readonly [Symbol.toStringTag]: "BigInt";
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* A typed array of 64-bit signed integer values. The contents are initialized to 0. If the
|
|
223
|
+
* requested number of bytes could not be allocated, an exception is raised.
|
|
224
|
+
*/
|
|
225
|
+
interface BigInt64Array$1 {
|
|
226
|
+
/** The size in bytes of each element in the array. */
|
|
227
|
+
readonly BYTES_PER_ELEMENT: number;
|
|
228
|
+
/** The ArrayBuffer instance referenced by the array. */
|
|
229
|
+
readonly buffer: ArrayBufferLike;
|
|
230
|
+
/** The length in bytes of the array. */
|
|
231
|
+
readonly byteLength: number;
|
|
232
|
+
/** The offset in bytes of the array. */
|
|
233
|
+
readonly byteOffset: number;
|
|
234
|
+
/**
|
|
235
|
+
* Returns the this object after copying a section of the array identified by start and end
|
|
236
|
+
* to the same array starting at position target
|
|
237
|
+
* @param target If target is negative, it is treated as length+target where length is the
|
|
238
|
+
* length of the array.
|
|
239
|
+
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
240
|
+
* is treated as length+end.
|
|
241
|
+
* @param end If not specified, length of the this object is used as its default value.
|
|
242
|
+
*/
|
|
243
|
+
copyWithin(target: number, start: number, end?: number): this;
|
|
244
|
+
/** Yields index, value pairs for every entry in the array. */
|
|
245
|
+
entries(): IterableIterator<[number, bigint]>;
|
|
246
|
+
/**
|
|
247
|
+
* Determines whether all the members of an array satisfy the specified test.
|
|
248
|
+
* @param predicate A function that accepts up to three arguments. The every method calls
|
|
249
|
+
* the predicate function for each element in the array until the predicate returns false,
|
|
250
|
+
* or until the end of the array.
|
|
251
|
+
* @param thisArg An object to which the this keyword can refer in the predicate function.
|
|
252
|
+
* If thisArg is omitted, undefined is used as the this value.
|
|
253
|
+
*/
|
|
254
|
+
every(predicate: (value: bigint, index: number, array: BigInt64Array$1) => boolean, thisArg?: any): boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
|
|
257
|
+
* @param value value to fill array section with
|
|
258
|
+
* @param start index to start filling the array at. If start is negative, it is treated as
|
|
259
|
+
* length+start where length is the length of the array.
|
|
260
|
+
* @param end index to stop filling the array at. If end is negative, it is treated as
|
|
261
|
+
* length+end.
|
|
262
|
+
*/
|
|
263
|
+
fill(value: bigint, start?: number, end?: number): this;
|
|
264
|
+
/**
|
|
265
|
+
* Returns the elements of an array that meet the condition specified in a callback function.
|
|
266
|
+
* @param predicate A function that accepts up to three arguments. The filter method calls
|
|
267
|
+
* the predicate function one time for each element in the array.
|
|
268
|
+
* @param thisArg An object to which the this keyword can refer in the predicate function.
|
|
269
|
+
* If thisArg is omitted, undefined is used as the this value.
|
|
270
|
+
*/
|
|
271
|
+
filter(predicate: (value: bigint, index: number, array: BigInt64Array$1) => any, thisArg?: any): BigInt64Array$1;
|
|
272
|
+
/**
|
|
273
|
+
* Returns the value of the first element in the array where predicate is true, and undefined
|
|
274
|
+
* otherwise.
|
|
275
|
+
* @param predicate find calls predicate once for each element of the array, in ascending
|
|
276
|
+
* order, until it finds one where predicate returns true. If such an element is found, find
|
|
277
|
+
* immediately returns that element value. Otherwise, find returns undefined.
|
|
278
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
279
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
280
|
+
*/
|
|
281
|
+
find(predicate: (value: bigint, index: number, array: BigInt64Array$1) => boolean, thisArg?: any): bigint | undefined;
|
|
282
|
+
/**
|
|
283
|
+
* Returns the index of the first element in the array where predicate is true, and -1
|
|
284
|
+
* otherwise.
|
|
285
|
+
* @param predicate find calls predicate once for each element of the array, in ascending
|
|
286
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
287
|
+
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
|
288
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
289
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
290
|
+
*/
|
|
291
|
+
findIndex(predicate: (value: bigint, index: number, array: BigInt64Array$1) => boolean, thisArg?: any): number;
|
|
292
|
+
/**
|
|
293
|
+
* Performs the specified action for each element in an array.
|
|
294
|
+
* @param callbackfn A function that accepts up to three arguments. forEach calls the
|
|
295
|
+
* callbackfn function one time for each element in the array.
|
|
296
|
+
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
|
297
|
+
* If thisArg is omitted, undefined is used as the this value.
|
|
298
|
+
*/
|
|
299
|
+
forEach(callbackfn: (value: bigint, index: number, array: BigInt64Array$1) => void, thisArg?: any): void;
|
|
300
|
+
/**
|
|
301
|
+
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
|
302
|
+
* @param searchElement The element to search for.
|
|
303
|
+
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
|
304
|
+
*/
|
|
305
|
+
includes(searchElement: bigint, fromIndex?: number): boolean;
|
|
306
|
+
/**
|
|
307
|
+
* Returns the index of the first occurrence of a value in an array.
|
|
308
|
+
* @param searchElement The value to locate in the array.
|
|
309
|
+
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
|
310
|
+
* search starts at index 0.
|
|
311
|
+
*/
|
|
312
|
+
indexOf(searchElement: bigint, fromIndex?: number): number;
|
|
313
|
+
/**
|
|
314
|
+
* Adds all the elements of an array separated by the specified separator string.
|
|
315
|
+
* @param separator A string used to separate one element of an array from the next in the
|
|
316
|
+
* resulting String. If omitted, the array elements are separated with a comma.
|
|
317
|
+
*/
|
|
318
|
+
join(separator?: string): string;
|
|
319
|
+
/** Yields each index in the array. */
|
|
320
|
+
keys(): IterableIterator<number>;
|
|
321
|
+
/**
|
|
322
|
+
* Returns the index of the last occurrence of a value in an array.
|
|
323
|
+
* @param searchElement The value to locate in the array.
|
|
324
|
+
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
|
325
|
+
* search starts at index 0.
|
|
326
|
+
*/
|
|
327
|
+
lastIndexOf(searchElement: bigint, fromIndex?: number): number;
|
|
328
|
+
/** The length of the array. */
|
|
329
|
+
readonly length: number;
|
|
330
|
+
/**
|
|
331
|
+
* Calls a defined callback function on each element of an array, and returns an array that
|
|
332
|
+
* contains the results.
|
|
333
|
+
* @param callbackfn A function that accepts up to three arguments. The map method calls the
|
|
334
|
+
* callbackfn function one time for each element in the array.
|
|
335
|
+
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
|
336
|
+
* If thisArg is omitted, undefined is used as the this value.
|
|
337
|
+
*/
|
|
338
|
+
map(callbackfn: (value: bigint, index: number, array: BigInt64Array$1) => bigint, thisArg?: any): BigInt64Array$1;
|
|
339
|
+
/**
|
|
340
|
+
* Calls the specified callback function for all the elements in an array. The return value of
|
|
341
|
+
* the callback function is the accumulated result, and is provided as an argument in the next
|
|
342
|
+
* call to the callback function.
|
|
343
|
+
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
|
344
|
+
* callbackfn function one time for each element in the array.
|
|
345
|
+
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
346
|
+
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
|
347
|
+
* instead of an array value.
|
|
348
|
+
*/
|
|
349
|
+
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array$1) => bigint): bigint;
|
|
350
|
+
/**
|
|
351
|
+
* Calls the specified callback function for all the elements in an array. The return value of
|
|
352
|
+
* the callback function is the accumulated result, and is provided as an argument in the next
|
|
353
|
+
* call to the callback function.
|
|
354
|
+
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
|
355
|
+
* callbackfn function one time for each element in the array.
|
|
356
|
+
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
357
|
+
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
|
358
|
+
* instead of an array value.
|
|
359
|
+
*/
|
|
360
|
+
reduce<U$1>(callbackfn: (previousValue: U$1, currentValue: bigint, currentIndex: number, array: BigInt64Array$1) => U$1, initialValue: U$1): U$1;
|
|
361
|
+
/**
|
|
362
|
+
* Calls the specified callback function for all the elements in an array, in descending order.
|
|
363
|
+
* The return value of the callback function is the accumulated result, and is provided as an
|
|
364
|
+
* argument in the next call to the callback function.
|
|
365
|
+
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
|
366
|
+
* the callbackfn function one time for each element in the array.
|
|
367
|
+
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
368
|
+
* the accumulation. The first call to the callbackfn function provides this value as an
|
|
369
|
+
* argument instead of an array value.
|
|
370
|
+
*/
|
|
371
|
+
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array$1) => bigint): bigint;
|
|
372
|
+
/**
|
|
373
|
+
* Calls the specified callback function for all the elements in an array, in descending order.
|
|
374
|
+
* The return value of the callback function is the accumulated result, and is provided as an
|
|
375
|
+
* argument in the next call to the callback function.
|
|
376
|
+
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
|
377
|
+
* the callbackfn function one time for each element in the array.
|
|
378
|
+
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
379
|
+
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
|
380
|
+
* instead of an array value.
|
|
381
|
+
*/
|
|
382
|
+
reduceRight<U$1>(callbackfn: (previousValue: U$1, currentValue: bigint, currentIndex: number, array: BigInt64Array$1) => U$1, initialValue: U$1): U$1;
|
|
383
|
+
/** Reverses the elements in the array. */
|
|
384
|
+
reverse(): this;
|
|
385
|
+
/**
|
|
386
|
+
* Sets a value or an array of values.
|
|
387
|
+
* @param array A typed or untyped array of values to set.
|
|
388
|
+
* @param offset The index in the current array at which the values are to be written.
|
|
389
|
+
*/
|
|
390
|
+
set(array: ArrayLike<bigint>, offset?: number): void;
|
|
391
|
+
/**
|
|
392
|
+
* Returns a section of an array.
|
|
393
|
+
* @param start The beginning of the specified portion of the array.
|
|
394
|
+
* @param end The end of the specified portion of the array.
|
|
395
|
+
*/
|
|
396
|
+
slice(start?: number, end?: number): BigInt64Array$1;
|
|
397
|
+
/**
|
|
398
|
+
* Determines whether the specified callback function returns true for any element of an array.
|
|
399
|
+
* @param predicate A function that accepts up to three arguments. The some method calls the
|
|
400
|
+
* predicate function for each element in the array until the predicate returns true, or until
|
|
401
|
+
* the end of the array.
|
|
402
|
+
* @param thisArg An object to which the this keyword can refer in the predicate function.
|
|
403
|
+
* If thisArg is omitted, undefined is used as the this value.
|
|
404
|
+
*/
|
|
405
|
+
some(predicate: (value: bigint, index: number, array: BigInt64Array$1) => boolean, thisArg?: any): boolean;
|
|
406
|
+
/**
|
|
407
|
+
* Sorts the array.
|
|
408
|
+
* @param compareFn The function used to determine the order of the elements. If omitted, the elements are sorted in ascending order.
|
|
409
|
+
*/
|
|
410
|
+
sort(compareFn?: (a: bigint, b: bigint) => number | bigint): this;
|
|
411
|
+
/**
|
|
412
|
+
* Gets a new BigInt64Array view of the ArrayBuffer store for this array, referencing the elements
|
|
413
|
+
* at begin, inclusive, up to end, exclusive.
|
|
414
|
+
* @param begin The index of the beginning of the array.
|
|
415
|
+
* @param end The index of the end of the array.
|
|
416
|
+
*/
|
|
417
|
+
subarray(begin?: number, end?: number): BigInt64Array$1;
|
|
418
|
+
/** Converts the array to a string by using the current locale. */
|
|
419
|
+
toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;
|
|
420
|
+
/** Returns a string representation of the array. */
|
|
421
|
+
toString(): string;
|
|
422
|
+
/** Returns the primitive value of the specified object. */
|
|
423
|
+
valueOf(): BigInt64Array$1;
|
|
424
|
+
/** Yields each value in the array. */
|
|
425
|
+
values(): IterableIterator<bigint>;
|
|
426
|
+
[Symbol.iterator](): IterableIterator<bigint>;
|
|
427
|
+
readonly [Symbol.toStringTag]: "BigInt64Array";
|
|
428
|
+
[index: number]: bigint;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* A typed array of 64-bit unsigned integer values. The contents are initialized to 0. If the
|
|
432
|
+
* requested number of bytes could not be allocated, an exception is raised.
|
|
433
|
+
*/
|
|
434
|
+
interface BigUint64Array$1 {
|
|
435
|
+
/** The size in bytes of each element in the array. */
|
|
436
|
+
readonly BYTES_PER_ELEMENT: number;
|
|
437
|
+
/** The ArrayBuffer instance referenced by the array. */
|
|
438
|
+
readonly buffer: ArrayBufferLike;
|
|
439
|
+
/** The length in bytes of the array. */
|
|
440
|
+
readonly byteLength: number;
|
|
441
|
+
/** The offset in bytes of the array. */
|
|
442
|
+
readonly byteOffset: number;
|
|
443
|
+
/**
|
|
444
|
+
* Returns the this object after copying a section of the array identified by start and end
|
|
445
|
+
* to the same array starting at position target
|
|
446
|
+
* @param target If target is negative, it is treated as length+target where length is the
|
|
447
|
+
* length of the array.
|
|
448
|
+
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
449
|
+
* is treated as length+end.
|
|
450
|
+
* @param end If not specified, length of the this object is used as its default value.
|
|
451
|
+
*/
|
|
452
|
+
copyWithin(target: number, start: number, end?: number): this;
|
|
453
|
+
/** Yields index, value pairs for every entry in the array. */
|
|
454
|
+
entries(): IterableIterator<[number, bigint]>;
|
|
455
|
+
/**
|
|
456
|
+
* Determines whether all the members of an array satisfy the specified test.
|
|
457
|
+
* @param predicate A function that accepts up to three arguments. The every method calls
|
|
458
|
+
* the predicate function for each element in the array until the predicate returns false,
|
|
459
|
+
* or until the end of the array.
|
|
460
|
+
* @param thisArg An object to which the this keyword can refer in the predicate function.
|
|
461
|
+
* If thisArg is omitted, undefined is used as the this value.
|
|
462
|
+
*/
|
|
463
|
+
every(predicate: (value: bigint, index: number, array: BigUint64Array$1) => boolean, thisArg?: any): boolean;
|
|
464
|
+
/**
|
|
465
|
+
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
|
|
466
|
+
* @param value value to fill array section with
|
|
467
|
+
* @param start index to start filling the array at. If start is negative, it is treated as
|
|
468
|
+
* length+start where length is the length of the array.
|
|
469
|
+
* @param end index to stop filling the array at. If end is negative, it is treated as
|
|
470
|
+
* length+end.
|
|
471
|
+
*/
|
|
472
|
+
fill(value: bigint, start?: number, end?: number): this;
|
|
473
|
+
/**
|
|
474
|
+
* Returns the elements of an array that meet the condition specified in a callback function.
|
|
475
|
+
* @param predicate A function that accepts up to three arguments. The filter method calls
|
|
476
|
+
* the predicate function one time for each element in the array.
|
|
477
|
+
* @param thisArg An object to which the this keyword can refer in the predicate function.
|
|
478
|
+
* If thisArg is omitted, undefined is used as the this value.
|
|
479
|
+
*/
|
|
480
|
+
filter(predicate: (value: bigint, index: number, array: BigUint64Array$1) => any, thisArg?: any): BigUint64Array$1;
|
|
481
|
+
/**
|
|
482
|
+
* Returns the value of the first element in the array where predicate is true, and undefined
|
|
483
|
+
* otherwise.
|
|
484
|
+
* @param predicate find calls predicate once for each element of the array, in ascending
|
|
485
|
+
* order, until it finds one where predicate returns true. If such an element is found, find
|
|
486
|
+
* immediately returns that element value. Otherwise, find returns undefined.
|
|
487
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
488
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
489
|
+
*/
|
|
490
|
+
find(predicate: (value: bigint, index: number, array: BigUint64Array$1) => boolean, thisArg?: any): bigint | undefined;
|
|
491
|
+
/**
|
|
492
|
+
* Returns the index of the first element in the array where predicate is true, and -1
|
|
493
|
+
* otherwise.
|
|
494
|
+
* @param predicate find calls predicate once for each element of the array, in ascending
|
|
495
|
+
* order, until it finds one where predicate returns true. If such an element is found,
|
|
496
|
+
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
|
497
|
+
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
498
|
+
* predicate. If it is not provided, undefined is used instead.
|
|
499
|
+
*/
|
|
500
|
+
findIndex(predicate: (value: bigint, index: number, array: BigUint64Array$1) => boolean, thisArg?: any): number;
|
|
501
|
+
/**
|
|
502
|
+
* Performs the specified action for each element in an array.
|
|
503
|
+
* @param callbackfn A function that accepts up to three arguments. forEach calls the
|
|
504
|
+
* callbackfn function one time for each element in the array.
|
|
505
|
+
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
|
506
|
+
* If thisArg is omitted, undefined is used as the this value.
|
|
507
|
+
*/
|
|
508
|
+
forEach(callbackfn: (value: bigint, index: number, array: BigUint64Array$1) => void, thisArg?: any): void;
|
|
509
|
+
/**
|
|
510
|
+
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
|
511
|
+
* @param searchElement The element to search for.
|
|
512
|
+
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
|
513
|
+
*/
|
|
514
|
+
includes(searchElement: bigint, fromIndex?: number): boolean;
|
|
515
|
+
/**
|
|
516
|
+
* Returns the index of the first occurrence of a value in an array.
|
|
517
|
+
* @param searchElement The value to locate in the array.
|
|
518
|
+
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
|
519
|
+
* search starts at index 0.
|
|
520
|
+
*/
|
|
521
|
+
indexOf(searchElement: bigint, fromIndex?: number): number;
|
|
522
|
+
/**
|
|
523
|
+
* Adds all the elements of an array separated by the specified separator string.
|
|
524
|
+
* @param separator A string used to separate one element of an array from the next in the
|
|
525
|
+
* resulting String. If omitted, the array elements are separated with a comma.
|
|
526
|
+
*/
|
|
527
|
+
join(separator?: string): string;
|
|
528
|
+
/** Yields each index in the array. */
|
|
529
|
+
keys(): IterableIterator<number>;
|
|
530
|
+
/**
|
|
531
|
+
* Returns the index of the last occurrence of a value in an array.
|
|
532
|
+
* @param searchElement The value to locate in the array.
|
|
533
|
+
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
|
534
|
+
* search starts at index 0.
|
|
535
|
+
*/
|
|
536
|
+
lastIndexOf(searchElement: bigint, fromIndex?: number): number;
|
|
537
|
+
/** The length of the array. */
|
|
538
|
+
readonly length: number;
|
|
539
|
+
/**
|
|
540
|
+
* Calls a defined callback function on each element of an array, and returns an array that
|
|
541
|
+
* contains the results.
|
|
542
|
+
* @param callbackfn A function that accepts up to three arguments. The map method calls the
|
|
543
|
+
* callbackfn function one time for each element in the array.
|
|
544
|
+
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
|
545
|
+
* If thisArg is omitted, undefined is used as the this value.
|
|
546
|
+
*/
|
|
547
|
+
map(callbackfn: (value: bigint, index: number, array: BigUint64Array$1) => bigint, thisArg?: any): BigUint64Array$1;
|
|
548
|
+
/**
|
|
549
|
+
* Calls the specified callback function for all the elements in an array. The return value of
|
|
550
|
+
* the callback function is the accumulated result, and is provided as an argument in the next
|
|
551
|
+
* call to the callback function.
|
|
552
|
+
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
|
553
|
+
* callbackfn function one time for each element in the array.
|
|
554
|
+
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
555
|
+
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
|
556
|
+
* instead of an array value.
|
|
557
|
+
*/
|
|
558
|
+
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array$1) => bigint): bigint;
|
|
559
|
+
/**
|
|
560
|
+
* Calls the specified callback function for all the elements in an array. The return value of
|
|
561
|
+
* the callback function is the accumulated result, and is provided as an argument in the next
|
|
562
|
+
* call to the callback function.
|
|
563
|
+
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
|
564
|
+
* callbackfn function one time for each element in the array.
|
|
565
|
+
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
566
|
+
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
|
567
|
+
* instead of an array value.
|
|
568
|
+
*/
|
|
569
|
+
reduce<U$1>(callbackfn: (previousValue: U$1, currentValue: bigint, currentIndex: number, array: BigUint64Array$1) => U$1, initialValue: U$1): U$1;
|
|
570
|
+
/**
|
|
571
|
+
* Calls the specified callback function for all the elements in an array, in descending order.
|
|
572
|
+
* The return value of the callback function is the accumulated result, and is provided as an
|
|
573
|
+
* argument in the next call to the callback function.
|
|
574
|
+
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
|
575
|
+
* the callbackfn function one time for each element in the array.
|
|
576
|
+
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
577
|
+
* the accumulation. The first call to the callbackfn function provides this value as an
|
|
578
|
+
* argument instead of an array value.
|
|
579
|
+
*/
|
|
580
|
+
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array$1) => bigint): bigint;
|
|
581
|
+
/**
|
|
582
|
+
* Calls the specified callback function for all the elements in an array, in descending order.
|
|
583
|
+
* The return value of the callback function is the accumulated result, and is provided as an
|
|
584
|
+
* argument in the next call to the callback function.
|
|
585
|
+
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
|
586
|
+
* the callbackfn function one time for each element in the array.
|
|
587
|
+
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
588
|
+
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
|
589
|
+
* instead of an array value.
|
|
590
|
+
*/
|
|
591
|
+
reduceRight<U$1>(callbackfn: (previousValue: U$1, currentValue: bigint, currentIndex: number, array: BigUint64Array$1) => U$1, initialValue: U$1): U$1;
|
|
592
|
+
/** Reverses the elements in the array. */
|
|
593
|
+
reverse(): this;
|
|
594
|
+
/**
|
|
595
|
+
* Sets a value or an array of values.
|
|
596
|
+
* @param array A typed or untyped array of values to set.
|
|
597
|
+
* @param offset The index in the current array at which the values are to be written.
|
|
598
|
+
*/
|
|
599
|
+
set(array: ArrayLike<bigint>, offset?: number): void;
|
|
600
|
+
/**
|
|
601
|
+
* Returns a section of an array.
|
|
602
|
+
* @param start The beginning of the specified portion of the array.
|
|
603
|
+
* @param end The end of the specified portion of the array.
|
|
604
|
+
*/
|
|
605
|
+
slice(start?: number, end?: number): BigUint64Array$1;
|
|
606
|
+
/**
|
|
607
|
+
* Determines whether the specified callback function returns true for any element of an array.
|
|
608
|
+
* @param predicate A function that accepts up to three arguments. The some method calls the
|
|
609
|
+
* predicate function for each element in the array until the predicate returns true, or until
|
|
610
|
+
* the end of the array.
|
|
611
|
+
* @param thisArg An object to which the this keyword can refer in the predicate function.
|
|
612
|
+
* If thisArg is omitted, undefined is used as the this value.
|
|
613
|
+
*/
|
|
614
|
+
some(predicate: (value: bigint, index: number, array: BigUint64Array$1) => boolean, thisArg?: any): boolean;
|
|
615
|
+
/**
|
|
616
|
+
* Sorts the array.
|
|
617
|
+
* @param compareFn The function used to determine the order of the elements. If omitted, the elements are sorted in ascending order.
|
|
618
|
+
*/
|
|
619
|
+
sort(compareFn?: (a: bigint, b: bigint) => number | bigint): this;
|
|
620
|
+
/**
|
|
621
|
+
* Gets a new BigUint64Array view of the ArrayBuffer store for this array, referencing the elements
|
|
622
|
+
* at begin, inclusive, up to end, exclusive.
|
|
623
|
+
* @param begin The index of the beginning of the array.
|
|
624
|
+
* @param end The index of the end of the array.
|
|
625
|
+
*/
|
|
626
|
+
subarray(begin?: number, end?: number): BigUint64Array$1;
|
|
627
|
+
/** Converts the array to a string by using the current locale. */
|
|
628
|
+
toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;
|
|
629
|
+
/** Returns a string representation of the array. */
|
|
630
|
+
toString(): string;
|
|
631
|
+
/** Returns the primitive value of the specified object. */
|
|
632
|
+
valueOf(): BigUint64Array$1;
|
|
633
|
+
/** Yields each value in the array. */
|
|
634
|
+
values(): IterableIterator<bigint>;
|
|
635
|
+
[Symbol.iterator](): IterableIterator<bigint>;
|
|
636
|
+
readonly [Symbol.toStringTag]: "BigUint64Array";
|
|
637
|
+
[index: number]: bigint;
|
|
638
|
+
}
|
|
639
|
+
interface BigIntToLocaleStringOptions {
|
|
640
|
+
/**
|
|
641
|
+
* The locale matching algorithm to use.The default is "best fit". For information about this option, see the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation Intl page}.
|
|
642
|
+
*/
|
|
643
|
+
localeMatcher?: string;
|
|
644
|
+
/**
|
|
645
|
+
* The formatting style to use , the default is "decimal".
|
|
646
|
+
*/
|
|
647
|
+
style?: string;
|
|
648
|
+
numberingSystem?: string;
|
|
649
|
+
/**
|
|
650
|
+
* The unit to use in unit formatting, Possible values are core unit identifiers, defined in UTS #35, Part 2, Section 6. A subset of units from the full list was selected for use in ECMAScript. Pairs of simple units can be concatenated with "-per-" to make a compound unit. There is no default value; if the style is "unit", the unit property must be provided.
|
|
651
|
+
*/
|
|
652
|
+
unit?: string;
|
|
653
|
+
/**
|
|
654
|
+
* The unit formatting style to use in unit formatting, the defaults is "short".
|
|
655
|
+
*/
|
|
656
|
+
unitDisplay?: string;
|
|
657
|
+
/**
|
|
658
|
+
* The currency to use in currency formatting. Possible values are the ISO 4217 currency codes, such as "USD" for the US dollar, "EUR" for the euro, or "CNY" for the Chinese RMB — see the Current currency & funds code list. There is no default value; if the style is "currency", the currency property must be provided. It is only used when [[Style]] has the value "currency".
|
|
659
|
+
*/
|
|
660
|
+
currency?: string;
|
|
661
|
+
/**
|
|
662
|
+
* How to display the currency in currency formatting. It is only used when [[Style]] has the value "currency". The default is "symbol".
|
|
663
|
+
*
|
|
664
|
+
* "symbol" to use a localized currency symbol such as €,
|
|
665
|
+
*
|
|
666
|
+
* "code" to use the ISO currency code,
|
|
667
|
+
*
|
|
668
|
+
* "name" to use a localized currency name such as "dollar"
|
|
669
|
+
*/
|
|
670
|
+
currencyDisplay?: string;
|
|
671
|
+
/**
|
|
672
|
+
* Whether to use grouping separators, such as thousands separators or thousand/lakh/crore separators. The default is true.
|
|
673
|
+
*/
|
|
674
|
+
useGrouping?: boolean;
|
|
675
|
+
/**
|
|
676
|
+
* The minimum number of integer digits to use. Possible values are from 1 to 21; the default is 1.
|
|
677
|
+
*/
|
|
678
|
+
minimumIntegerDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
|
|
679
|
+
/**
|
|
680
|
+
* The minimum number of fraction digits to use. Possible values are from 0 to 20; the default for plain number and percent formatting is 0; the default for currency formatting is the number of minor unit digits provided by the {@link http://www.currency-iso.org/en/home/tables/table-a1.html ISO 4217 currency codes list} (2 if the list doesn't provide that information).
|
|
681
|
+
*/
|
|
682
|
+
minimumFractionDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
|
|
683
|
+
/**
|
|
684
|
+
* The maximum number of fraction digits to use. Possible values are from 0 to 20; the default for plain number formatting is the larger of minimumFractionDigits and 3; the default for currency formatting is the larger of minimumFractionDigits and the number of minor unit digits provided by the {@link http://www.currency-iso.org/en/home/tables/table-a1.html ISO 4217 currency codes list} (2 if the list doesn't provide that information); the default for percent formatting is the larger of minimumFractionDigits and 0.
|
|
685
|
+
*/
|
|
686
|
+
maximumFractionDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
|
|
687
|
+
/**
|
|
688
|
+
* The minimum number of significant digits to use. Possible values are from 1 to 21; the default is 1.
|
|
689
|
+
*/
|
|
690
|
+
minimumSignificantDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
|
|
691
|
+
/**
|
|
692
|
+
* The maximum number of significant digits to use. Possible values are from 1 to 21; the default is 21.
|
|
693
|
+
*/
|
|
694
|
+
maximumSignificantDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
|
|
695
|
+
/**
|
|
696
|
+
* The formatting that should be displayed for the number, the defaults is "standard"
|
|
697
|
+
*
|
|
698
|
+
* "standard" plain number formatting
|
|
699
|
+
*
|
|
700
|
+
* "scientific" return the order-of-magnitude for formatted number.
|
|
701
|
+
*
|
|
702
|
+
* "engineering" return the exponent of ten when divisible by three
|
|
703
|
+
*
|
|
704
|
+
* "compact" string representing exponent, defaults is using the "short" form
|
|
705
|
+
*/
|
|
706
|
+
notation?: string;
|
|
707
|
+
/**
|
|
708
|
+
* used only when notation is "compact"
|
|
709
|
+
*/
|
|
710
|
+
compactDisplay?: string;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* The `Any` class does not exist at runtime. It's used in type
|
|
714
|
+
* definitions to detect an `any` type.
|
|
715
|
+
*
|
|
716
|
+
* ```ts
|
|
717
|
+
* type IsAny<T> = [T] extends [Any] ? 'is any' : 'is not any'
|
|
718
|
+
* ```
|
|
719
|
+
*/
|
|
720
|
+
declare class Any {
|
|
721
|
+
private any;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Represents a class constructor.
|
|
725
|
+
*/
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Get all properties **not using** the `?:` type operator.
|
|
729
|
+
*/
|
|
730
|
+
type RequiredKeys<T> = T extends any ? keyof T extends infer K ? K extends keyof T ? Omit<T, K> extends T ? never : K : never : never : never;
|
|
731
|
+
/**
|
|
732
|
+
* Get all properties using the `?:` type operator.
|
|
733
|
+
*/
|
|
734
|
+
type OptionalKeys<T> = T extends any ? keyof T extends infer K ? K extends keyof T ? Omit<T, K> extends T ? K : never : never : never : never;
|
|
735
|
+
/**
|
|
736
|
+
* Resolves to `true` if `Left` and `Right` are exactly the same type.
|
|
737
|
+
*
|
|
738
|
+
* Otherwise false.
|
|
739
|
+
*/
|
|
740
|
+
type IsExactType<Left, Right> = [Left] extends [Any] ? [Right] extends [Any] ? true : false : (<U$1>() => U$1 extends Left ? 1 : 0) extends (<U$1>() => U$1 extends Right ? 1 : 0) ? true : false;
|
|
741
|
+
type Primitive = number | string | boolean | symbol | bigint | null | undefined | void;
|
|
742
|
+
/**
|
|
743
|
+
* Coerce a primitive type to its boxed equivalent.
|
|
744
|
+
*
|
|
745
|
+
* @example
|
|
746
|
+
* ```ts
|
|
747
|
+
* type A = BoxedPrimitive<string>
|
|
748
|
+
* // ^? String
|
|
749
|
+
* type B = BoxedPrimitive<number>
|
|
750
|
+
* // ^? Number
|
|
751
|
+
* ```
|
|
752
|
+
*/
|
|
753
|
+
type BoxedPrimitive<T = any> = T extends string ? String : T extends number ? Number : T extends boolean ? Boolean : T extends bigint ? BigInt : T extends symbol ? Symbol : never;
|
|
754
|
+
type TypedArray$1 = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array$1 | BigUint64Array$1 | DataView | ArrayBuffer | SharedArrayBuffer;
|
|
755
|
+
/**
|
|
756
|
+
* Add your own classes to this registry by extending its interface
|
|
757
|
+
* with what's called “declaration merging” in TypeScript.
|
|
758
|
+
*
|
|
759
|
+
* All property types in this registry type may be treated specially
|
|
760
|
+
* by any of Radashi's complex types. For example, `assign` will avoid
|
|
761
|
+
* merging with types in this registry.
|
|
762
|
+
*/
|
|
763
|
+
interface CustomClassRegistry {}
|
|
764
|
+
/**
|
|
765
|
+
* This type represents any custom class that was "registered" through
|
|
766
|
+
* the `CustomClassRegistry` type.
|
|
767
|
+
*/
|
|
768
|
+
type CustomClass = CustomClassRegistry[keyof CustomClassRegistry];
|
|
769
|
+
/**
|
|
770
|
+
* These types are implemented natively.
|
|
771
|
+
*
|
|
772
|
+
* Note that boxed primitives like `Boolean` (different from
|
|
773
|
+
* `boolean`) are not included, because `boolean extends Boolean ? 1 :
|
|
774
|
+
* 0` resolves to 1.
|
|
775
|
+
*/
|
|
776
|
+
type BuiltInType = ES2021.BuiltInType | WebAPI.BuiltInType | NodeJS.BuiltInType;
|
|
777
|
+
declare namespace ES2020 {
|
|
778
|
+
type BuiltInType = Primitive | Promise<any> | Date | RegExp | Error | readonly any[] | ReadonlyMap<any, any> | ReadonlySet<any> | WeakMap<WeakKey, any> | WeakSet<WeakKey> | TypedArray$1 | Function;
|
|
779
|
+
}
|
|
780
|
+
declare namespace ES2021 {
|
|
781
|
+
type BuiltInType = ES2020.BuiltInType | GlobalObjectType<'FinalizationRegistry'> | GlobalObjectType<'WeakRef'>;
|
|
782
|
+
}
|
|
783
|
+
declare namespace NodeJS {
|
|
784
|
+
type BuiltInType = GlobalObjectType<'Buffer'>;
|
|
785
|
+
}
|
|
786
|
+
declare namespace WebAPI {
|
|
787
|
+
type BuiltInType = GlobalObjectType<'AbortController'> | GlobalObjectType<'AbortSignal'> | GlobalObjectType<'Blob'> | GlobalObjectType<'Body'> | GlobalObjectType<'CompressionStream'> | GlobalObjectType<'Crypto'> | GlobalObjectType<'CustomEvent'> | GlobalObjectType<'DecompressionStream'> | GlobalObjectType<'Event'> | GlobalObjectType<'EventTarget'> | GlobalObjectType<'FormData'> | GlobalObjectType<'Headers'> | GlobalObjectType<'MessageChannel'> | GlobalObjectType<'Navigator'> | GlobalObjectType<'ReadableStream'> | GlobalObjectType<'ReadableStreamBYOBReader'> | GlobalObjectType<'ReadableStreamDefaultController'> | GlobalObjectType<'ReadableStreamDefaultReader'> | GlobalObjectType<'SubtleCrypto'> | GlobalObjectType<'TextDecoder'> | GlobalObjectType<'TextDecoderStream'> | GlobalObjectType<'TextEncoder'> | GlobalObjectType<'TextEncoderStream'> | GlobalObjectType<'TransformStream'> | GlobalObjectType<'TransformStreamDefaultController'> | GlobalObjectType<'URL'> | GlobalObjectType<'URLSearchParams'> | GlobalObjectType<'WebSocket'> | GlobalObjectType<'WritableStream'> | GlobalObjectType<'WritableStreamDefaultController'> | GlobalObjectType<'WritableStreamDefaultWriter'> | WebDocumentAPI.BuiltInType;
|
|
788
|
+
}
|
|
789
|
+
declare namespace WebDocumentAPI {
|
|
790
|
+
type BuiltInType = GlobalObjectType<'Node'> | GlobalObjectType<'NodeList'> | GlobalObjectType<'NodeIterator'> | GlobalObjectType<'HTMLCollection'> | GlobalObjectType<'CSSStyleDeclaration'> | GlobalObjectType<'DOMStringList'> | GlobalObjectType<'DOMTokenList'>;
|
|
791
|
+
}
|
|
792
|
+
type GlobalObjectType<Identifier extends string> = [Identifier] extends [Any] ? never : keyof Identifier extends never ? never : typeof globalThis extends { [P in Identifier]: any } ? InstanceType<(typeof globalThis)[Identifier]> : never;
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Converts a `PromiseLike` to a `Promise<Result>`.
|
|
796
|
+
*
|
|
797
|
+
* Note: If the given promise throws a non-Error value, it will be
|
|
798
|
+
* rethrown.
|
|
799
|
+
*
|
|
800
|
+
* @see https://radashi.js.org/reference/async/toResult
|
|
801
|
+
* @example
|
|
802
|
+
* ```ts
|
|
803
|
+
* import { toResult, Result } from 'radashi'
|
|
804
|
+
*
|
|
805
|
+
* const good = async (): Promise<number> => 1
|
|
806
|
+
* const bad = async (): Promise<number> => { throw new Error('bad') }
|
|
807
|
+
*
|
|
808
|
+
* const goodResult = await toResult(good())
|
|
809
|
+
* // => [undefined, 1]
|
|
810
|
+
*
|
|
811
|
+
* const badResult = await toResult(bad())
|
|
812
|
+
* // => [Error('bad'), undefined]
|
|
813
|
+
* ```
|
|
814
|
+
* @version 12.4.0
|
|
815
|
+
*/
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* The return type for `assign`.
|
|
819
|
+
*
|
|
820
|
+
* It recursively merges object types that are not native objects. The
|
|
821
|
+
* root objects are always merged.
|
|
822
|
+
*
|
|
823
|
+
* @see https://radashi.js.org/reference/object/assign
|
|
824
|
+
*/
|
|
825
|
+
type Assign<TInitial extends object, TOverride extends object> = TInitial extends any ? TOverride extends any ? SimplifyMutable<Omit<TInitial, keyof TOverride> & Omit<TOverride, keyof TInitial> & (Pick<TInitial, keyof TInitial & keyof TOverride> extends infer TConflictInitial ? Pick<TOverride, keyof TInitial & keyof TOverride> extends infer TConflictOverride ? { [K in RequiredKeys<TConflictOverride>]: AssignDeep<TConflictInitial[K & keyof TConflictInitial], TConflictOverride[K]> } & { [K in RequiredKeys<TConflictInitial> & OptionalKeys<TConflictOverride>]: AssignDeep<TConflictInitial[K], TConflictOverride[K], true> } & { [K in OptionalKeys<TConflictInitial> & OptionalKeys<TConflictOverride>]?: AssignDeep<TConflictInitial[K], TConflictOverride[K], true> } : unknown : unknown)> : never : never;
|
|
826
|
+
/**
|
|
827
|
+
* Mimic the `Simplify` type and also remove `readonly` modifiers.
|
|
828
|
+
*/
|
|
829
|
+
type SimplifyMutable<T> = {} & { -readonly [P in keyof T]: T[P] };
|
|
830
|
+
/**
|
|
831
|
+
* This represents a value that should only be replaced if it exists
|
|
832
|
+
* as an initial value; never deeply assigned into.
|
|
833
|
+
*/
|
|
834
|
+
type AtomicValue = BuiltInType | CustomClass | BoxedPrimitive;
|
|
835
|
+
/**
|
|
836
|
+
* Handle mixed types when merging nested plain objects.
|
|
837
|
+
*
|
|
838
|
+
* For example, if the type `TOverride` includes both `string` and `{ n:
|
|
839
|
+
* number }` in a union, `AssignDeep` will treat `string` as
|
|
840
|
+
* unmergeable and `{ n: number }` as mergeable.
|
|
841
|
+
*/
|
|
842
|
+
type AssignDeep<TInitial, TOverride, IsOptional = false> = never
|
|
843
|
+
/**
|
|
844
|
+
* When a native type is found in TInitial, it will only exist in
|
|
845
|
+
* the result type if the override is optional.
|
|
846
|
+
*/ | (TInitial extends AtomicValue ? IsOptional extends true ? TInitial : never : never)
|
|
847
|
+
/**
|
|
848
|
+
* When a native type is found in TOverride, it will always exists
|
|
849
|
+
* in the result type.
|
|
850
|
+
*/ | (TOverride extends AtomicValue ? TOverride : never)
|
|
851
|
+
/**
|
|
852
|
+
* Deep assignment is handled in this branch.
|
|
853
|
+
*
|
|
854
|
+
* 1. Exclude any native types from TInitial and TOverride
|
|
855
|
+
* 2. If a non-native object type is not found in TInitial, simply
|
|
856
|
+
* replace TInitial (or use "A | B" if the override is optional)
|
|
857
|
+
* 3. For each non-native object type in TOverride, deep assign to
|
|
858
|
+
* every non-native object in TInitial
|
|
859
|
+
* 4. For each non-object type in TOverride, simply replace TInitial
|
|
860
|
+
* (or use "A | B" if the override is optional)
|
|
861
|
+
*/ | (Exclude<TOverride, AtomicValue> extends infer TOverride ? Exclude<TInitial, Exclude<AtomicValue, void>> extends infer TInitial ? [Extract<TInitial, object>] extends [never] ? TOverride | (IsOptional extends true ? TInitial : never) : TInitial extends object ? TOverride extends object ? IsExactType<TOverride, TInitial> extends true ? TOverride : Assign<TInitial, TOverride> :
|
|
862
|
+
// 4.
|
|
863
|
+
TOverride | (IsOptional extends true ? TInitial : never) : Extract<TOverride, object> | (IsOptional extends true ? TInitial : never) : never : never);
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* Creates a shallow copy of the given object/value.
|
|
867
|
+
*
|
|
868
|
+
* @see https://radashi.js.org/reference/object/clone
|
|
869
|
+
* @example
|
|
870
|
+
* ```ts
|
|
871
|
+
* const original = { a: 1, b: { c: 3 } }
|
|
872
|
+
* const cloned = clone(original)
|
|
873
|
+
* // => { a: 1, b: { c: 3 } }
|
|
874
|
+
* original !== cloned
|
|
875
|
+
* // => true
|
|
876
|
+
* original.b === cloned.b
|
|
877
|
+
* // => true
|
|
878
|
+
* ```
|
|
879
|
+
* @version 12.1.0
|
|
880
|
+
*/
|
|
206
881
|
//#endregion
|
|
207
882
|
//#region src/utils/object/objectAssign.d.ts
|
|
208
883
|
/**
|
|
@@ -212,7 +887,11 @@ declare function mapEntries<K extends PropertyKey, V, NK extends PropertyKey, NV
|
|
|
212
887
|
* @param initial 初始对象
|
|
213
888
|
* @param override 待合并对象
|
|
214
889
|
*/
|
|
215
|
-
declare function objectAssign<I extends UnknownObject, O extends UnknownObject>(initial: I, override: O): Assign<I, O>;
|
|
890
|
+
declare function objectAssign<I$1 extends UnknownObject, O extends UnknownObject>(initial: I$1, override: O): Assign<I$1, O>;
|
|
891
|
+
//#endregion
|
|
892
|
+
//#region src/utils/object/objectCrush.d.ts
|
|
893
|
+
type Crush<T> = T extends readonly (infer U)[] ? Record<string, U extends object ? unknown : U> : Simplify<UnionToIntersection<keyof T extends infer Prop ? Prop extends keyof T ? T[Prop] extends infer Value ? ([Extract<Value, object>] extends [never] ? never : Record<string, unknown>) | ([Exclude<Value, object>] extends [never] ? never : [Extract<Value, object>] extends [never] ? { [P in Prop]: Value } : Record<string, unknown>) : never : never : never>>;
|
|
894
|
+
declare function objectCrush<T extends UnknownObject>(value: T): Crush<T>;
|
|
216
895
|
//#endregion
|
|
217
896
|
//#region src/utils/object/objectEntries.d.ts
|
|
218
897
|
/**
|
|
@@ -232,7 +911,7 @@ declare function objectEntries<O extends AnyObject>(obj: O): [string & keyof O,
|
|
|
232
911
|
declare function objectKeys<O extends AnyObject>(obj: O): (keyof O)[];
|
|
233
912
|
//#endregion
|
|
234
913
|
//#region src/utils/object/objectPick.d.ts
|
|
235
|
-
declare function objectPick<O extends AnyObject, K extends keyof O>(obj: O, keys: readonly K[]): Pick<O, K>;
|
|
914
|
+
declare function objectPick<O extends AnyObject, K$1 extends keyof O>(obj: O, keys: readonly K$1[]): Pick<O, K$1>;
|
|
236
915
|
//#endregion
|
|
237
916
|
//#region src/utils/object/objectSwitch.d.ts
|
|
238
917
|
/**
|
|
@@ -255,22 +934,25 @@ declare function objectValues<O extends AnyObject>(obj: O): UnionToTuple<ValueOf
|
|
|
255
934
|
/**
|
|
256
935
|
* 首字母大小写
|
|
257
936
|
*/
|
|
258
|
-
declare function stringInitialCase(
|
|
937
|
+
declare function stringInitialCase(input: string, type: "lower" | "upper"): string;
|
|
259
938
|
//#endregion
|
|
260
939
|
//#region src/utils/string/stringReplace.d.ts
|
|
261
|
-
declare function stringReplace<I extends string, S extends string, R extends string>(input: I, search: S, replacement: R): Replace<I, S, R>;
|
|
940
|
+
declare function stringReplace<I$1 extends string, S extends string, R$1 extends string>(input: I$1, search: S, replacement: R$1): Replace<I$1, S, R$1>;
|
|
941
|
+
//#endregion
|
|
942
|
+
//#region src/utils/string/stringTemplate.d.ts
|
|
943
|
+
declare function stringTemplate(input: string, data: Record<string, unknown>, regex?: RegExp): string;
|
|
262
944
|
//#endregion
|
|
263
945
|
//#region src/utils/string/stringToJson.d.ts
|
|
264
|
-
declare function stringToJson<R extends AnyObject = AnyObject, D extends R = R>(
|
|
946
|
+
declare function stringToJson<R$1 extends AnyObject = AnyObject, D extends R$1 = R$1>(input: string | null | undefined, safeValue: D): R$1;
|
|
265
947
|
//#endregion
|
|
266
948
|
//#region src/utils/string/stringToNumber.d.ts
|
|
267
949
|
/**
|
|
268
950
|
* 从字符串中提取数字
|
|
269
951
|
*/
|
|
270
|
-
declare function stringToNumber(
|
|
952
|
+
declare function stringToNumber(input: string): string;
|
|
271
953
|
//#endregion
|
|
272
954
|
//#region src/utils/string/stringToValues.d.ts
|
|
273
|
-
declare function stringToValues<T extends number | string = number>(
|
|
955
|
+
declare function stringToValues<T extends number | string = number>(input: string | null | undefined, valueType?: "number" | "string", splitSymbol?: string): T[];
|
|
274
956
|
//#endregion
|
|
275
957
|
//#region src/utils/tree/types.d.ts
|
|
276
958
|
type RowKey = "id";
|
|
@@ -308,9 +990,9 @@ declare function treeForEach<T extends AnyObject, CK extends string = ChildrenKe
|
|
|
308
990
|
//#endregion
|
|
309
991
|
//#region src/utils/tree/treeMap.d.ts
|
|
310
992
|
type TreeMapOptions<T extends AnyObject, CK extends string> = BaseOptions<T, CK>;
|
|
311
|
-
type TreeMapCallback<R extends AnyObject, T extends AnyObject> = (row: T, meta: BaseCallbackMeta<T>) => R;
|
|
312
|
-
declare function treeMap<R extends AnyObject, T extends AnyObject, CK extends string = ChildrenKey>(tree: T[], callback: TreeMapCallback<R, T>, options?: TreeMapOptions<T, CK>): TreeLike<R, CK>[];
|
|
313
|
-
declare function treeMap<R extends AnyObject, T extends AnyObject, CK extends string = ChildrenKey>(tree: T, callback: TreeMapCallback<R, T>, options?: TreeMapOptions<T, CK>): TreeLike<R, CK>;
|
|
993
|
+
type TreeMapCallback<R$1 extends AnyObject, T extends AnyObject> = (row: T, meta: BaseCallbackMeta<T>) => R$1;
|
|
994
|
+
declare function treeMap<R$1 extends AnyObject, T extends AnyObject, CK extends string = ChildrenKey>(tree: T[], callback: TreeMapCallback<R$1, T>, options?: TreeMapOptions<T, CK>): TreeLike<R$1, CK>[];
|
|
995
|
+
declare function treeMap<R$1 extends AnyObject, T extends AnyObject, CK extends string = ChildrenKey>(tree: T, callback: TreeMapCallback<R$1, T>, options?: TreeMapOptions<T, CK>): TreeLike<R$1, CK>;
|
|
314
996
|
//#endregion
|
|
315
997
|
//#region src/utils/tree/rowsToTree.d.ts
|
|
316
998
|
interface RowsToTreeOptions<RK extends string = RowKey, PK extends string = ParentIdKey, CK extends string = ChildrenKey> {
|
|
@@ -321,14 +1003,14 @@ interface RowsToTreeOptions<RK extends string = RowKey, PK extends string = Pare
|
|
|
321
1003
|
/**
|
|
322
1004
|
* 行结构 转 树结构
|
|
323
1005
|
*/
|
|
324
|
-
declare function rowsToTree<T extends AnyObject = AnyObject, CK extends string = ChildrenKey, R = TreeLike<T, CK>, RK extends string = RowKey, PK extends string = ParentIdKey>(rows: T[], options?: RowsToTreeOptions<RK, PK, CK> | undefined): R[];
|
|
1006
|
+
declare function rowsToTree<T extends AnyObject = AnyObject, CK extends string = ChildrenKey, R$1 = TreeLike<T, CK>, RK extends string = RowKey, PK extends string = ParentIdKey>(rows: T[], options?: RowsToTreeOptions<RK, PK, CK> | undefined): R$1[];
|
|
325
1007
|
//#endregion
|
|
326
1008
|
//#region src/utils/tree/treeToRows.d.ts
|
|
327
1009
|
type TreeToRowsOptions<T extends AnyObject, CK extends string = ChildrenKey> = TreeForeachOptions<T, CK>;
|
|
328
1010
|
/**
|
|
329
1011
|
* 树结构 转 行结构
|
|
330
1012
|
*/
|
|
331
|
-
declare function treeToRows<T extends AnyObject, CK extends string = ChildrenKey, R extends AnyObject = SetOptional<T, CK>>(tree: T | T[], options?: TreeToRowsOptions<T, CK>): R[];
|
|
1013
|
+
declare function treeToRows<T extends AnyObject, CK extends string = ChildrenKey, R$1 extends AnyObject = SetOptional<T, CK>>(tree: T | T[], options?: TreeToRowsOptions<T, CK>): R$1[];
|
|
332
1014
|
//#endregion
|
|
333
1015
|
//#region src/utils/typeof/isArray.d.ts
|
|
334
1016
|
type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
|
|
@@ -458,5 +1140,5 @@ declare function isWebSocket(value: unknown): value is WebSocket;
|
|
|
458
1140
|
//#region src/utils/typeof/isWindow.d.ts
|
|
459
1141
|
declare function isWindow(value: unknown): value is Window;
|
|
460
1142
|
//#endregion
|
|
461
|
-
export { arrayCast, arrayCompete, arrayCounting, arrayDifference, arrayFirst, arrayFork, arrayIntersection, arrayLast, arrayMerge, arrayPick, arrayReplace, arraySplit, cloneDeep, enumEntries, enumKeys, enumTypeCheck, enumValues, isArray, isAsyncFunction, isAsyncGeneratorFunction, isBigInt, isBlob, isBoolean, isClass, isDate, isEqual, isError, isFalsy, isFalsyLike, isFile, isFunction, isGeneratorFunction, isInfinity, isInfinityLike, isInteger, isIterable, isMap, isNaN, isNegativeInteger, isNull, isNumber, isObject, isPositiveInteger, isPromise, isPromiseLike, isRegExp, isSet, isString, isSymbol, isTypedArray, isURLSearchParams, isUndefined, isWeakMap, isWeakSet, isWebSocket, isWindow, mapEntries, objectAssign, objectEntries, objectKeys, objectPick, objectSwitch, objectValues, rowsToTree, stringInitialCase, stringReplace, stringToJson, stringToNumber, stringToValues, to, toMathBignumber, toMathDecimal, toMathEvaluate, treeFilter, treeFind, treeForEach, treeMap, treeToRows };
|
|
1143
|
+
export { type Crush, arrayCast, arrayCompete, arrayCounting, arrayDifference, arrayFirst, arrayFork, arrayIntersection, arrayLast, arrayMerge, arrayPick, arrayReplace, arraySplit, cloneDeep, enumEntries, enumKeys, enumTypeCheck, enumValues, isArray, isAsyncFunction, isAsyncGeneratorFunction, isBigInt, isBlob, isBoolean, isClass, isDate, isEqual, isError, isFalsy, isFalsyLike, isFile, isFunction, isGeneratorFunction, isInfinity, isInfinityLike, isInteger, isIterable, isMap, isNaN, isNegativeInteger, isNull, isNumber, isObject, isPositiveInteger, isPromise, isPromiseLike, isRegExp, isSet, isString, isSymbol, isTypedArray, isURLSearchParams, isUndefined, isWeakMap, isWeakSet, isWebSocket, isWindow, mapEntries, objectAssign, objectCrush, objectEntries, objectKeys, objectPick, objectSwitch, objectValues, rowsToTree, stringInitialCase, stringReplace, stringTemplate, stringToJson, stringToNumber, stringToValues, to, toMathBignumber, toMathDecimal, toMathEvaluate, treeFilter, treeFind, treeForEach, treeMap, treeToRows };
|
|
462
1144
|
//# sourceMappingURL=index.d.ts.map
|