@oscarpalmer/atoms 0.202.0 → 0.204.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/array/difference.d.mts +4 -5
- package/dist/array/exists.d.mts +5 -6
- package/dist/array/filter.d.mts +10 -11
- package/dist/array/filter.mjs +0 -1
- package/dist/array/find.d.mts +10 -11
- package/dist/array/find.mjs +0 -1
- package/dist/array/first.d.mts +10 -11
- package/dist/array/first.mjs +0 -1
- package/dist/array/flatten.d.mts +2 -3
- package/dist/array/from.d.mts +7 -8
- package/dist/array/group-by.d.mts +7 -8
- package/dist/array/group-by.mjs +0 -1
- package/dist/array/insert.d.mts +3 -4
- package/dist/array/intersection.d.mts +4 -5
- package/dist/array/last.d.mts +10 -11
- package/dist/array/last.mjs +0 -1
- package/dist/array/move.d.mts +9 -10
- package/dist/array/move.mjs +0 -4
- package/dist/array/partition.d.mts +5 -6
- package/dist/array/push.d.mts +2 -3
- package/dist/array/reverse.d.mts +2 -3
- package/dist/array/select.d.mts +11 -12
- package/dist/array/select.mjs +0 -1
- package/dist/array/single.d.mts +4 -5
- package/dist/array/slice.d.mts +12 -13
- package/dist/array/sort.d.mts +31 -32
- package/dist/array/sort.mjs +38 -39
- package/dist/array/splice.d.mts +5 -6
- package/dist/array/swap.d.mts +8 -9
- package/dist/array/swap.mjs +0 -1
- package/dist/array/to-map.d.mts +7 -8
- package/dist/array/to-map.mjs +0 -1
- package/dist/array/to-record.d.mts +7 -8
- package/dist/array/to-record.mjs +0 -1
- package/dist/array/to-set.d.mts +4 -5
- package/dist/array/toggle.d.mts +4 -5
- package/dist/array/union.d.mts +4 -5
- package/dist/array/unique.d.mts +4 -5
- package/dist/array/update.d.mts +4 -5
- package/dist/beacon.d.mts +8 -9
- package/dist/beacon.mjs +96 -71
- package/dist/color/constants.d.mts +14 -13
- package/dist/color/constants.mjs +9 -2
- package/dist/color/index.d.mts +2 -2
- package/dist/color/instance.d.mts +3 -3
- package/dist/color/instance.mjs +91 -69
- package/dist/color/misc/alpha.d.mts +7 -6
- package/dist/color/misc/alpha.mjs +8 -2
- package/dist/color/misc/format.d.mts +6 -7
- package/dist/color/misc/format.mjs +15 -12
- package/dist/color/misc/get.d.mts +14 -15
- package/dist/color/misc/is.d.mts +16 -17
- package/dist/color/misc/is.mjs +7 -7
- package/dist/color/misc/state.d.mts +33 -10
- package/dist/color/misc/state.mjs +28 -48
- package/dist/color/models.d.mts +25 -19
- package/dist/color/space/hex.d.mts +14 -11
- package/dist/color/space/hex.mjs +21 -2
- package/dist/color/space/hsl.d.mts +13 -10
- package/dist/color/space/hsl.mjs +25 -4
- package/dist/color/space/hwb.d.mts +14 -11
- package/dist/color/space/hwb.mjs +24 -3
- package/dist/color/space/rgb.d.mts +16 -13
- package/dist/color/space/rgb.mjs +41 -20
- package/dist/function/limit.d.mts +9 -8
- package/dist/function/limit.mjs +5 -7
- package/dist/function/once.d.mts +26 -6
- package/dist/function/once.mjs +129 -76
- package/dist/function/retry.d.mts +5 -6
- package/dist/function/retry.mjs +3 -4
- package/dist/index.d.mts +184 -60
- package/dist/index.mjs +1292 -970
- package/dist/internal/aborter.d.mts +9 -0
- package/dist/internal/{abort.mjs → aborter.mjs} +1 -1
- package/dist/internal/array/callbacks.d.mts +4 -5
- package/dist/internal/array/chunk.d.mts +2 -3
- package/dist/internal/array/compact.d.mts +3 -4
- package/dist/internal/array/find.d.mts +10 -11
- package/dist/internal/array/get.d.mts +7 -8
- package/dist/internal/array/get.mjs +3 -2
- package/dist/internal/array/group.d.mts +2 -3
- package/dist/internal/array/index-of.d.mts +10 -11
- package/dist/internal/array/index-of.mjs +0 -1
- package/dist/internal/array/insert.d.mts +5 -6
- package/dist/internal/array/match.d.mts +17 -18
- package/dist/internal/array/overlap.d.mts +2 -3
- package/dist/internal/array/sets.d.mts +5 -6
- package/dist/internal/array/shuffle.d.mts +2 -3
- package/dist/internal/array/update.d.mts +2 -3
- package/dist/internal/defaults.d.mts +3 -4
- package/dist/internal/function/assert.d.mts +10 -11
- package/dist/internal/function/assert.mjs +0 -7
- package/dist/internal/function/limit.d.mts +41 -0
- package/dist/internal/function/limit.mjs +106 -0
- package/dist/internal/function/memoize.d.mts +4 -5
- package/dist/internal/function/memoize.mjs +55 -31
- package/dist/internal/function/misc.d.mts +2 -3
- package/dist/internal/function/work.d.mts +53 -54
- package/dist/internal/function/work.mjs +0 -2
- package/dist/internal/herald.d.mts +8 -9
- package/dist/internal/herald.mjs +38 -27
- package/dist/internal/is.d.mts +19 -20
- package/dist/internal/math/aggregate.d.mts +14 -15
- package/dist/internal/math/misc.d.mts +3 -4
- package/dist/internal/number.d.mts +4 -5
- package/dist/internal/random.d.mts +3 -4
- package/dist/internal/result/misc.d.mts +29 -14
- package/dist/internal/result/misc.mjs +4 -3
- package/dist/internal/result/models.d.mts +9 -10
- package/dist/internal/sized/map.d.mts +2 -3
- package/dist/internal/sized/misc.d.mts +2 -3
- package/dist/internal/string/case.d.mts +9 -10
- package/dist/internal/string/misc.d.mts +8 -9
- package/dist/internal/subscription.d.mts +10 -11
- package/dist/internal/subscription.mjs +72 -58
- package/dist/internal/value/compare.d.mts +17 -9
- package/dist/internal/value/compare.mjs +6 -11
- package/dist/internal/value/equal.d.mts +34 -15
- package/dist/internal/value/equal.mjs +20 -13
- package/dist/internal/value/get.d.mts +3 -4
- package/dist/internal/value/handlers.d.mts +19 -9
- package/dist/internal/value/handlers.mjs +48 -50
- package/dist/internal/value/has.d.mts +6 -7
- package/dist/internal/value/has.mjs +0 -1
- package/dist/internal/value/misc.d.mts +6 -7
- package/dist/internal/value/misc.mjs +4 -3
- package/dist/internal/value/partial.d.mts +3 -4
- package/dist/internal/value/partial.mjs +2 -1
- package/dist/internal/value/set.d.mts +4 -5
- package/dist/internal/value/set.mjs +2 -1
- package/dist/is.d.mts +13 -13
- package/dist/logger.d.mts +5 -4
- package/dist/logger.mjs +72 -64
- package/dist/math.d.mts +20 -20
- package/dist/models.d.mts +45 -49
- package/dist/promise/constants.d.mts +14 -15
- package/dist/promise/delay.d.mts +3 -4
- package/dist/promise/delay.mjs +5 -5
- package/dist/promise/helpers.d.mts +7 -8
- package/dist/promise/helpers.mjs +4 -3
- package/dist/promise/index.d.mts +13 -14
- package/dist/promise/index.mjs +1 -2
- package/dist/promise/misc.d.mts +7 -7
- package/dist/promise/models.d.mts +17 -18
- package/dist/promise/timed.d.mts +4 -5
- package/dist/promise/timed.mjs +6 -6
- package/dist/query.d.mts +3 -4
- package/dist/queue.d.mts +14 -15
- package/dist/queue.mjs +198 -136
- package/dist/random.d.mts +8 -8
- package/dist/result/index.d.mts +8 -9
- package/dist/result/index.mjs +0 -1
- package/dist/result/match.d.mts +6 -7
- package/dist/result/match.mjs +0 -1
- package/dist/result/misc.d.mts +3 -3
- package/dist/result/work/flow.d.mts +28 -29
- package/dist/result/work/flow.mjs +0 -1
- package/dist/result/work/pipe.d.mts +24 -25
- package/dist/result/work/pipe.mjs +0 -1
- package/dist/sized/set.d.mts +2 -3
- package/dist/string/fuzzy.d.mts +21 -12
- package/dist/string/fuzzy.mjs +77 -52
- package/dist/string/index.d.mts +8 -8
- package/dist/string/match.d.mts +4 -5
- package/dist/string/normalize.d.mts +8 -9
- package/dist/string/normalize.mjs +9 -5
- package/dist/string/template.d.mts +9 -9
- package/dist/string/template.mjs +11 -5
- package/dist/value/clone.d.mts +21 -13
- package/dist/value/clone.mjs +19 -25
- package/dist/value/collection.d.mts +4 -5
- package/dist/value/diff.d.mts +5 -6
- package/dist/value/freeze.d.mts +18 -19
- package/dist/value/freeze.mjs +1 -5
- package/dist/value/merge.d.mts +13 -14
- package/dist/value/merge.mjs +21 -7
- package/dist/value/omit.d.mts +2 -3
- package/dist/value/pick.d.mts +2 -3
- package/dist/value/shake.d.mts +3 -4
- package/dist/value/smush.d.mts +3 -4
- package/dist/value/transform.d.mts +15 -10
- package/dist/value/transform.mjs +12 -8
- package/dist/value/unsmush.d.mts +3 -4
- package/package.json +2 -2
- package/dist/internal/abort.d.mts +0 -10
- package/dist/internal/function/timer.d.mts +0 -10
- package/dist/internal/function/timer.mjs +0 -87
package/dist/index.d.mts
CHANGED
|
@@ -3,30 +3,12 @@
|
|
|
3
3
|
* A generic array or object
|
|
4
4
|
*/
|
|
5
5
|
export type ArrayOrPlainObject = unknown[] | Record<PropertyKey, unknown>;
|
|
6
|
-
/**
|
|
7
|
-
* An asynchronous callback that can be canceled
|
|
8
|
-
*/
|
|
9
|
-
export type AsyncCancelableCallback<Callback extends GenericAsyncCallback | GenericCallback> = (ReturnType<Callback> extends Promise<any> ? (...args: Parameters<Callback>) => Promise<Awaited<ReturnType<Callback>>> : (...args: Parameters<Callback>) => Promise<ReturnType<Callback>>) & {
|
|
10
|
-
/**
|
|
11
|
-
* Cancel the callback
|
|
12
|
-
*/
|
|
13
|
-
cancel: () => void;
|
|
14
|
-
};
|
|
15
6
|
/**
|
|
16
7
|
* For matching any `void`, `Date`, primitive, or `RegExp` values
|
|
17
8
|
*
|
|
18
9
|
* _(Thanks, type-fest!)_
|
|
19
10
|
*/
|
|
20
11
|
export type BuiltIns = void | Date | Primitive | RegExp;
|
|
21
|
-
/**
|
|
22
|
-
* A synchronous callback that can be canceled
|
|
23
|
-
*/
|
|
24
|
-
export type CancelableCallback<Callback extends GenericCallback> = Callback & {
|
|
25
|
-
/**
|
|
26
|
-
* Cancel the callback
|
|
27
|
-
*/
|
|
28
|
-
cancel: () => void;
|
|
29
|
-
};
|
|
30
12
|
/**
|
|
31
13
|
* A generic class constructor
|
|
32
14
|
*/
|
|
@@ -93,7 +75,7 @@ export type NumericalValues<Item extends PlainObject> = { [ItemKey in keyof Item
|
|
|
93
75
|
/**
|
|
94
76
|
* An asynchronous function that can only be called once, returning the same value on subsequent calls
|
|
95
77
|
*/
|
|
96
|
-
|
|
78
|
+
type OnceAsync<Callback extends GenericAsyncCallback> = {
|
|
97
79
|
/**
|
|
98
80
|
* Did the callback's promise reject?
|
|
99
81
|
*/
|
|
@@ -102,12 +84,27 @@ export type OnceAsyncCallback<Callback extends GenericAsyncCallback> = {
|
|
|
102
84
|
* Has the callback finished?
|
|
103
85
|
*/
|
|
104
86
|
readonly finished: boolean;
|
|
105
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Run the callback
|
|
89
|
+
*
|
|
90
|
+
* @param parameters Callback parameters
|
|
91
|
+
* @returns Call result
|
|
92
|
+
*/
|
|
93
|
+
run: (...parameters: Parameters<Callback>) => ReturnType<Callback>;
|
|
94
|
+
} & OnceProperties;
|
|
106
95
|
/**
|
|
107
96
|
* A callback function that can only be called once, returning the same value on subsequent calls
|
|
108
97
|
*/
|
|
109
|
-
|
|
110
|
-
|
|
98
|
+
type Once<Callback extends GenericCallback> = {
|
|
99
|
+
/**
|
|
100
|
+
* Run the callback
|
|
101
|
+
*
|
|
102
|
+
* @param parameters Callback parameters
|
|
103
|
+
* @returns Call result
|
|
104
|
+
*/
|
|
105
|
+
run: (...parameters: Parameters<Callback>) => ReturnType<Callback>;
|
|
106
|
+
} & OnceProperties;
|
|
107
|
+
type OnceProperties = {
|
|
111
108
|
/**
|
|
112
109
|
* Has the callback been called?
|
|
113
110
|
*/
|
|
@@ -2774,13 +2771,6 @@ export type SortDirection = 'ascending' | 'descending';
|
|
|
2774
2771
|
* Can be used to sort an array, get the predicted index for an item, and check if an array is sorted
|
|
2775
2772
|
*/
|
|
2776
2773
|
export type Sorter<Item> = {
|
|
2777
|
-
/**
|
|
2778
|
-
* Sort an array of items
|
|
2779
|
-
*
|
|
2780
|
-
* @param array Array to sort
|
|
2781
|
-
* @returns Sorted array
|
|
2782
|
-
*/
|
|
2783
|
-
(array: Item[]): Item[];
|
|
2784
2774
|
/**
|
|
2785
2775
|
* Get the index for an item _(to be inserted into an array of items)_
|
|
2786
2776
|
*
|
|
@@ -2798,6 +2788,13 @@ export type Sorter<Item> = {
|
|
|
2798
2788
|
* @returns `true` if sorted, otherwise `false`
|
|
2799
2789
|
*/
|
|
2800
2790
|
is(array: Item[]): boolean;
|
|
2791
|
+
/**
|
|
2792
|
+
* Sort an array of items
|
|
2793
|
+
*
|
|
2794
|
+
* @param array Array to sort
|
|
2795
|
+
* @returns Sorted array
|
|
2796
|
+
*/
|
|
2797
|
+
sort(array: Item[]): Item[];
|
|
2801
2798
|
};
|
|
2802
2799
|
/**
|
|
2803
2800
|
* Get the index for an item _(to be inserted into an array of items)_ based on sorters _(and an optional default direction)_
|
|
@@ -3332,6 +3329,40 @@ export declare function toRecordArrays<Item, KeyArg extends KeyOrCallback<Item,
|
|
|
3332
3329
|
*/
|
|
3333
3330
|
export declare function noop(): void;
|
|
3334
3331
|
//#endregion
|
|
3332
|
+
//#region src/internal/function/limit.d.ts
|
|
3333
|
+
/**
|
|
3334
|
+
* An asynchronous function that can be cancelled
|
|
3335
|
+
*/
|
|
3336
|
+
type AsyncLimiter<Callback extends GenericAsyncCallback> = {
|
|
3337
|
+
/**
|
|
3338
|
+
* Cancel the function
|
|
3339
|
+
*/
|
|
3340
|
+
cancel(): void;
|
|
3341
|
+
/**
|
|
3342
|
+
* Call the function
|
|
3343
|
+
*
|
|
3344
|
+
* @param parameters Function parameters
|
|
3345
|
+
* @returns Function result
|
|
3346
|
+
*/
|
|
3347
|
+
run(...parameters: Parameters<Callback>): Promise<ReturnType<Callback>>;
|
|
3348
|
+
};
|
|
3349
|
+
/**
|
|
3350
|
+
* A function that can be cancelled
|
|
3351
|
+
*/
|
|
3352
|
+
type Limiter<Callback extends GenericCallback> = {
|
|
3353
|
+
/**
|
|
3354
|
+
* Cancel the function
|
|
3355
|
+
*/
|
|
3356
|
+
cancel(): void;
|
|
3357
|
+
/**
|
|
3358
|
+
* Call the function
|
|
3359
|
+
*
|
|
3360
|
+
* @param parameters Function parameters
|
|
3361
|
+
* @returns Function result
|
|
3362
|
+
*/
|
|
3363
|
+
run(...parameters: Parameters<Callback>): ReturnType<Callback>;
|
|
3364
|
+
};
|
|
3365
|
+
//#endregion
|
|
3335
3366
|
//#region src/function/limit.d.ts
|
|
3336
3367
|
/**
|
|
3337
3368
|
* Debounce a function, ensuring it is only called after `time` milliseconds have passed
|
|
@@ -3345,7 +3376,7 @@ export declare function noop(): void;
|
|
|
3345
3376
|
* @param time Time in milliseconds to wait before calling the callback _(defaults to `0`; e.g., as soon as possible)_
|
|
3346
3377
|
* @returns Debounced callback handler with a `cancel` method
|
|
3347
3378
|
*/
|
|
3348
|
-
export declare function asyncDebounce<Callback extends GenericAsyncCallback | GenericCallback>(callback: Callback, time?: number):
|
|
3379
|
+
export declare function asyncDebounce<Callback extends GenericAsyncCallback | GenericCallback>(callback: Callback, time?: number): AsyncLimiter<Callback>;
|
|
3349
3380
|
/**
|
|
3350
3381
|
* Throttle a function, ensuring it is only called once every `time` milliseconds
|
|
3351
3382
|
*
|
|
@@ -3358,7 +3389,7 @@ export declare function asyncDebounce<Callback extends GenericAsyncCallback | Ge
|
|
|
3358
3389
|
* @param time Time in milliseconds to wait before calling the callback again _(defaults to `0`; e.g., as soon as possible)_
|
|
3359
3390
|
* @returns Throttled callback handler with a `cancel` method
|
|
3360
3391
|
*/
|
|
3361
|
-
export declare function asyncThrottle<Callback extends GenericAsyncCallback | GenericCallback>(callback: Callback, time?: number):
|
|
3392
|
+
export declare function asyncThrottle<Callback extends GenericAsyncCallback | GenericCallback>(callback: Callback, time?: number): AsyncLimiter<Callback>;
|
|
3362
3393
|
/**
|
|
3363
3394
|
* Debounce a function, ensuring it is only called after `time` milliseconds have passed
|
|
3364
3395
|
*
|
|
@@ -3368,7 +3399,7 @@ export declare function asyncThrottle<Callback extends GenericAsyncCallback | Ge
|
|
|
3368
3399
|
* @param time Time in milliseconds to wait before calling the callback _(defaults to `0`; e.g., as soon as possible)_
|
|
3369
3400
|
* @returns Debounced callback handler with a `cancel` method
|
|
3370
3401
|
*/
|
|
3371
|
-
export declare function debounce<Callback extends GenericCallback>(callback: Callback, time?: number):
|
|
3402
|
+
export declare function debounce<Callback extends GenericCallback>(callback: Callback, time?: number): Limiter<Callback>;
|
|
3372
3403
|
export declare namespace debounce {
|
|
3373
3404
|
var async: typeof asyncDebounce;
|
|
3374
3405
|
}
|
|
@@ -3379,12 +3410,14 @@ export declare namespace debounce {
|
|
|
3379
3410
|
* @param time Time in milliseconds to wait before calling the callback again _(defaults to `0`; e.g., as soon as possible)_
|
|
3380
3411
|
* @returns Throttled callback handler with a `cancel` method
|
|
3381
3412
|
*/
|
|
3382
|
-
export declare function throttle<Callback extends GenericCallback>(callback: Callback, time?: number):
|
|
3413
|
+
export declare function throttle<Callback extends GenericCallback>(callback: Callback, time?: number): Limiter<Callback>;
|
|
3383
3414
|
export declare namespace throttle {
|
|
3384
3415
|
var async: typeof asyncThrottle;
|
|
3385
3416
|
}
|
|
3386
3417
|
//#endregion
|
|
3387
3418
|
//#region src/function/once.d.ts
|
|
3419
|
+
declare function OnceAsync(this: any, callback: GenericAsyncCallback): void;
|
|
3420
|
+
declare function Once(this: any, callback: GenericCallback): void;
|
|
3388
3421
|
/**
|
|
3389
3422
|
* Create an asynchronous function that can only be called once, rejecting or resolving the same result on subsequent calls
|
|
3390
3423
|
*
|
|
@@ -3393,16 +3426,35 @@ export declare namespace throttle {
|
|
|
3393
3426
|
* @param callback Callback to use once
|
|
3394
3427
|
* @returns _Once_ callback
|
|
3395
3428
|
*/
|
|
3396
|
-
export declare function asyncOnce<Callback extends GenericAsyncCallback>(callback: Callback):
|
|
3429
|
+
export declare function asyncOnce<Callback extends GenericAsyncCallback>(callback: Callback): OnceAsync<Callback>;
|
|
3430
|
+
export declare namespace asyncOnce {
|
|
3431
|
+
var is: typeof isAsyncOnce;
|
|
3432
|
+
}
|
|
3433
|
+
/**
|
|
3434
|
+
* Is the value an asynchronous once callback?
|
|
3435
|
+
*
|
|
3436
|
+
* @param value Value to check
|
|
3437
|
+
* @returns `true` if the value is an asynchronous once callback, otherwise `false`
|
|
3438
|
+
*/
|
|
3439
|
+
export declare function isAsyncOnce(value: unknown): boolean;
|
|
3440
|
+
/**
|
|
3441
|
+
* Is the value a once callback?
|
|
3442
|
+
*
|
|
3443
|
+
* @param value Value to check
|
|
3444
|
+
* @returns `true` if the value is a once callback, otherwise `false`
|
|
3445
|
+
*/
|
|
3446
|
+
export declare function isOnce(value: unknown): boolean;
|
|
3397
3447
|
/**
|
|
3398
3448
|
* Create a function that can only be called once, returning the same value on subsequent calls
|
|
3399
3449
|
*
|
|
3400
3450
|
* @param callback Callback to use once
|
|
3401
3451
|
* @returns _Once_ callback
|
|
3402
3452
|
*/
|
|
3403
|
-
export declare function once<Callback extends GenericCallback>(callback: Callback):
|
|
3453
|
+
export declare function once<Callback extends GenericCallback>(callback: Callback): Once<Callback>;
|
|
3404
3454
|
export declare namespace once {
|
|
3405
3455
|
var async: typeof asyncOnce;
|
|
3456
|
+
var is: typeof isOnce;
|
|
3457
|
+
var isAsync: typeof isAsyncOnce;
|
|
3406
3458
|
}
|
|
3407
3459
|
//#endregion
|
|
3408
3460
|
//#region src/function/retry.d.ts
|
|
@@ -3967,7 +4019,7 @@ export declare function assertIs<Value>(condition: (value: unknown) => value is
|
|
|
3967
4019
|
* @param error Error constructor _(defaults to `Error`)_
|
|
3968
4020
|
* @returns _Asserter_
|
|
3969
4021
|
*/
|
|
3970
|
-
export declare function assertProperty<Value extends PlainObject, Path extends NestedKeys<Value
|
|
4022
|
+
export declare function assertProperty<Value extends PlainObject, Path extends NestedKeys<Value>>(path: Path, condition: (value: NestedValue<Value, Path>) => boolean, message: string, error?: ErrorConstructor): Asserter<NestedPick<Value, Path>>;
|
|
3971
4023
|
//#endregion
|
|
3972
4024
|
//#region src/internal/function/memoize.d.ts
|
|
3973
4025
|
/**
|
|
@@ -4206,10 +4258,19 @@ type Comparator<Value = any> = (first: Value, second: Value) => number;
|
|
|
4206
4258
|
export declare function compare(first: unknown, second: unknown): number;
|
|
4207
4259
|
export declare namespace compare {
|
|
4208
4260
|
var deregister: typeof deregisterComparator;
|
|
4209
|
-
var
|
|
4210
|
-
|
|
4261
|
+
var handler: {
|
|
4262
|
+
base: {
|
|
4263
|
+
handlers: WeakMap<WeakKey, string | GenericCallback>;
|
|
4264
|
+
options: {
|
|
4265
|
+
callback: GenericCallback;
|
|
4266
|
+
method?: string;
|
|
4267
|
+
};
|
|
4268
|
+
owner: GenericCallback;
|
|
4269
|
+
deregister: (constructor: Constructor) => void;
|
|
4270
|
+
get: (first: unknown, second: unknown) => string | GenericCallback | undefined;
|
|
4271
|
+
register: (constructor: Constructor, handler?: string | GenericCallback) => void;
|
|
4272
|
+
};
|
|
4211
4273
|
handle(first: unknown, second: unknown, ...parameters: unknown[]): number;
|
|
4212
|
-
register(constructor: Constructor, handler?: string | GenericCallback): void;
|
|
4213
4274
|
};
|
|
4214
4275
|
var register: typeof registerComparator;
|
|
4215
4276
|
}
|
|
@@ -4263,7 +4324,7 @@ type Equalizer = {
|
|
|
4263
4324
|
* @param ignoreCase If `true`, comparison will be case-insensitive
|
|
4264
4325
|
* @returns `true` if the strings are equal, otherwise `false`
|
|
4265
4326
|
*/
|
|
4266
|
-
(first: string, second: string, ignoreCase?: boolean): boolean;
|
|
4327
|
+
compare(first: string, second: string, ignoreCase?: boolean): boolean;
|
|
4267
4328
|
/**
|
|
4268
4329
|
* Are two values equal?
|
|
4269
4330
|
*
|
|
@@ -4271,7 +4332,7 @@ type Equalizer = {
|
|
|
4271
4332
|
* @param second Second value
|
|
4272
4333
|
* @returns `true` if the values are equal, otherwise `false`
|
|
4273
4334
|
*/
|
|
4274
|
-
(first: unknown, second: unknown): boolean;
|
|
4335
|
+
compare(first: unknown, second: unknown): boolean;
|
|
4275
4336
|
/**
|
|
4276
4337
|
* Deregister a equality comparison handler for a specific class
|
|
4277
4338
|
*
|
|
@@ -4286,6 +4347,17 @@ type Equalizer = {
|
|
|
4286
4347
|
*/
|
|
4287
4348
|
register: <Instance>(constructor: Constructor<Instance>, handler: (first: Instance, second: Instance) => boolean) => void;
|
|
4288
4349
|
};
|
|
4350
|
+
type Options = {
|
|
4351
|
+
ignoreCase: boolean;
|
|
4352
|
+
ignoreExpressions: OptionsKeys<RegExp[]>;
|
|
4353
|
+
ignoreKeys: OptionsKeys<Set<string>>;
|
|
4354
|
+
relaxedNullish: boolean;
|
|
4355
|
+
};
|
|
4356
|
+
type OptionsKeys<Values> = {
|
|
4357
|
+
enabled: boolean;
|
|
4358
|
+
values: Values;
|
|
4359
|
+
};
|
|
4360
|
+
declare function Equalizer(this: any, options: Options): void;
|
|
4289
4361
|
/**
|
|
4290
4362
|
* Deregister a equality comparison handler for a specific class
|
|
4291
4363
|
*
|
|
@@ -4313,12 +4385,21 @@ export declare function equal(first: string, second: string, ignoreCase?: boolea
|
|
|
4313
4385
|
*/
|
|
4314
4386
|
export declare function equal(first: unknown, second: unknown, options?: EqualOptions): boolean;
|
|
4315
4387
|
export declare namespace equal {
|
|
4316
|
-
var
|
|
4317
|
-
|
|
4388
|
+
var deregister: typeof deregisterEqualizer;
|
|
4389
|
+
var handler: {
|
|
4390
|
+
base: {
|
|
4391
|
+
handlers: WeakMap<WeakKey, string | GenericCallback>;
|
|
4392
|
+
options: {
|
|
4393
|
+
callback: GenericCallback;
|
|
4394
|
+
method?: string;
|
|
4395
|
+
};
|
|
4396
|
+
owner: GenericCallback;
|
|
4397
|
+
deregister: (constructor: Constructor) => void;
|
|
4398
|
+
get: (first: unknown, second: unknown) => string | GenericCallback | undefined;
|
|
4399
|
+
register: (constructor: Constructor, handler?: string | GenericCallback) => void;
|
|
4400
|
+
};
|
|
4318
4401
|
handle(first: unknown, second: unknown, ...parameters: unknown[]): boolean;
|
|
4319
|
-
register(constructor: Constructor, handler?: string | GenericCallback): void;
|
|
4320
4402
|
};
|
|
4321
|
-
var deregister: typeof deregisterEqualizer;
|
|
4322
4403
|
var initialize: typeof initializeEqualizer;
|
|
4323
4404
|
var register: typeof registerEqualizer;
|
|
4324
4405
|
}
|
|
@@ -4515,7 +4596,7 @@ export declare function setValue<Data extends PlainObject, Path extends NestedKe
|
|
|
4515
4596
|
*/
|
|
4516
4597
|
export declare function setValue<Data extends PlainObject>(data: Data, path: string, value: unknown, ignoreCase?: boolean): Data;
|
|
4517
4598
|
//#endregion
|
|
4518
|
-
//#region src/internal/
|
|
4599
|
+
//#region src/internal/aborter.d.ts
|
|
4519
4600
|
type Aborter = {
|
|
4520
4601
|
callback: GenericCallback;
|
|
4521
4602
|
signal: AbortSignal;
|
|
@@ -4767,9 +4848,14 @@ export declare function error<E>(value: E, original: Error): ExtendedErr<E>;
|
|
|
4767
4848
|
* @returns Error result
|
|
4768
4849
|
*/
|
|
4769
4850
|
export declare function error<E>(value: E): Err<E>;
|
|
4851
|
+
export declare namespace error {
|
|
4852
|
+
var is: typeof isError;
|
|
4853
|
+
}
|
|
4770
4854
|
/**
|
|
4771
4855
|
* Is the _Result_ an extended error?
|
|
4772
4856
|
*
|
|
4857
|
+
* _Available as `isError` and `error.is`_
|
|
4858
|
+
*
|
|
4773
4859
|
* @param result _Result_ to check
|
|
4774
4860
|
* @returns `true` if the _Result_ is an extended error, otherwise `false`
|
|
4775
4861
|
*/
|
|
@@ -4777,6 +4863,8 @@ export declare function isError<Value, E = Error>(result: ExtendedErr<E> | Resul
|
|
|
4777
4863
|
/**
|
|
4778
4864
|
* Is the _Result_ an error?
|
|
4779
4865
|
*
|
|
4866
|
+
* _Available as `isError` and `error.is`_
|
|
4867
|
+
*
|
|
4780
4868
|
* @param result _Result_ to check
|
|
4781
4869
|
* @returns `true` if the _Result_ is an error, otherwise `false`
|
|
4782
4870
|
*/
|
|
@@ -4784,6 +4872,8 @@ export declare function isError<Value, E = Error>(result: Result<Value, E>): res
|
|
|
4784
4872
|
/**
|
|
4785
4873
|
* Is the value an error?
|
|
4786
4874
|
*
|
|
4875
|
+
* _Available as `isError` and `error.is`_
|
|
4876
|
+
*
|
|
4787
4877
|
* @param value Value to check
|
|
4788
4878
|
* @returns `true` if the value is an error, otherwise `false`
|
|
4789
4879
|
*/
|
|
@@ -4791,6 +4881,8 @@ export declare function isError(value: unknown): value is Err<unknown> | Extende
|
|
|
4791
4881
|
/**
|
|
4792
4882
|
* Is the _Result_ ok?
|
|
4793
4883
|
*
|
|
4884
|
+
* _Available as `isOk` and `ok.is`_
|
|
4885
|
+
*
|
|
4794
4886
|
* @param value _Result_ to check
|
|
4795
4887
|
* @returns `true` if the _Result_ is ok, otherwise `false`
|
|
4796
4888
|
*/
|
|
@@ -4798,6 +4890,8 @@ export declare function isOk<Value, E = Error>(value: Result<Value, E>): value i
|
|
|
4798
4890
|
/**
|
|
4799
4891
|
* Is the value ok?
|
|
4800
4892
|
*
|
|
4893
|
+
* _Available as `isOk` and `ok.is`_
|
|
4894
|
+
*
|
|
4801
4895
|
* @param value Value to check
|
|
4802
4896
|
* @returns `true` if the value is ok, otherwise `false`
|
|
4803
4897
|
*/
|
|
@@ -4816,6 +4910,9 @@ export declare function isResult(value: unknown): value is ExtendedErr<unknown>
|
|
|
4816
4910
|
* @returns Ok result
|
|
4817
4911
|
*/
|
|
4818
4912
|
export declare function ok<Value>(value: Value): Ok<Value>;
|
|
4913
|
+
export declare namespace ok {
|
|
4914
|
+
var is: typeof isOk;
|
|
4915
|
+
}
|
|
4819
4916
|
/**
|
|
4820
4917
|
* Gets the value of an ok result _(or a default value)_
|
|
4821
4918
|
*
|
|
@@ -5488,6 +5585,7 @@ export declare function fuzzy<Item>(items: Item[], handler?: (item: Item) => str
|
|
|
5488
5585
|
*/
|
|
5489
5586
|
export declare function fuzzy<Item>(items: Item[], configuration?: FuzzyConfiguration<Item>): Fuzzy<Item>;
|
|
5490
5587
|
export declare namespace fuzzy {
|
|
5588
|
+
var is: typeof isFuzzy;
|
|
5491
5589
|
var match: typeof fuzzyMatch;
|
|
5492
5590
|
}
|
|
5493
5591
|
/**
|
|
@@ -5500,6 +5598,15 @@ export declare namespace fuzzy {
|
|
|
5500
5598
|
* @returns `true` if the needle matches the haystack in a fuzzy way, otherwise `false`
|
|
5501
5599
|
*/
|
|
5502
5600
|
export declare function fuzzyMatch(haystack: string, needle: string): boolean;
|
|
5601
|
+
/**
|
|
5602
|
+
* Is the value a fuzzy searcher?
|
|
5603
|
+
*
|
|
5604
|
+
* _Available as `isFuzzy` and `fuzzy.is`_
|
|
5605
|
+
*
|
|
5606
|
+
* @param value Value to check
|
|
5607
|
+
* @returns `true` if the value is a fuzzy searcher, otherwise `false`
|
|
5608
|
+
*/
|
|
5609
|
+
export declare function isFuzzy<Item = unknown>(value: unknown): value is Fuzzy<Item>;
|
|
5503
5610
|
//#endregion
|
|
5504
5611
|
//#region src/string/index.d.ts
|
|
5505
5612
|
/**
|
|
@@ -5620,7 +5727,7 @@ export type Normalizer = {
|
|
|
5620
5727
|
* @param value String to normalize
|
|
5621
5728
|
* @returns Normalized string
|
|
5622
5729
|
*/
|
|
5623
|
-
(value: string): string;
|
|
5730
|
+
normalize(value: string): string;
|
|
5624
5731
|
};
|
|
5625
5732
|
/**
|
|
5626
5733
|
* Deburr a string, removing diacritical marks
|
|
@@ -5680,7 +5787,7 @@ type Templater = {
|
|
|
5680
5787
|
*
|
|
5681
5788
|
* @returns Templated string
|
|
5682
5789
|
*/
|
|
5683
|
-
(strings: TemplateStringsArray, ...values: unknown[]): TemplaterRenderer;
|
|
5790
|
+
render(strings: TemplateStringsArray, ...values: unknown[]): TemplaterRenderer;
|
|
5684
5791
|
/**
|
|
5685
5792
|
* Render a string from a template with variables
|
|
5686
5793
|
*
|
|
@@ -5688,12 +5795,13 @@ type Templater = {
|
|
|
5688
5795
|
* @param variables Variables to use
|
|
5689
5796
|
* @returns Templated string
|
|
5690
5797
|
*/
|
|
5691
|
-
(value: string, variables?: PlainObject): string;
|
|
5798
|
+
render(value: string, variables?: PlainObject): string;
|
|
5692
5799
|
};
|
|
5693
5800
|
/**
|
|
5694
5801
|
* Render a template string with variables
|
|
5695
5802
|
*/
|
|
5696
5803
|
type TemplaterRenderer = (variables?: PlainObject) => string;
|
|
5804
|
+
declare function Templater(this: any, options: Required<TemplateOptions>): void;
|
|
5697
5805
|
/**
|
|
5698
5806
|
* Create a _Templater_ with predefined options
|
|
5699
5807
|
*
|
|
@@ -5743,7 +5851,7 @@ export type Cloner = {
|
|
|
5743
5851
|
* @param value Value to clone
|
|
5744
5852
|
* @returns Cloned value
|
|
5745
5853
|
*/
|
|
5746
|
-
<Value>(value: Value): Value;
|
|
5854
|
+
clone<Value>(value: Value): Value;
|
|
5747
5855
|
/**
|
|
5748
5856
|
* Deregister a clone handler for a specific class
|
|
5749
5857
|
*
|
|
@@ -5773,9 +5881,18 @@ export declare function clone<Value>(value: Value, options?: CloneOptions): Valu
|
|
|
5773
5881
|
export declare namespace clone {
|
|
5774
5882
|
var deregister: typeof deregisterCloner;
|
|
5775
5883
|
var handlers: {
|
|
5776
|
-
|
|
5884
|
+
base: {
|
|
5885
|
+
handlers: WeakMap<WeakKey, string | GenericCallback>;
|
|
5886
|
+
options: {
|
|
5887
|
+
callback: GenericCallback;
|
|
5888
|
+
method?: string;
|
|
5889
|
+
};
|
|
5890
|
+
owner: GenericCallback;
|
|
5891
|
+
deregister: (constructor: Constructor) => void;
|
|
5892
|
+
get: (first: unknown, second: unknown) => string | GenericCallback | undefined;
|
|
5893
|
+
register: (constructor: Constructor, handler?: string | GenericCallback) => void;
|
|
5894
|
+
};
|
|
5777
5895
|
handle(value: unknown, ...parameters: unknown[]): unknown;
|
|
5778
|
-
register(constructor: Constructor, handler?: string | GenericCallback): void;
|
|
5779
5896
|
};
|
|
5780
5897
|
var initialize: typeof initializeCloner;
|
|
5781
5898
|
var register: typeof registerCloner;
|
|
@@ -6120,7 +6237,7 @@ export type Assigner = {
|
|
|
6120
6237
|
* @param from Values to assign
|
|
6121
6238
|
* @returns Assigned value
|
|
6122
6239
|
*/
|
|
6123
|
-
<To extends PlainObject, From extends PlainObject[]>(to: To, from: [...From]): To & UnionToIntersection<From[number]>;
|
|
6240
|
+
assign<To extends PlainObject, From extends PlainObject[]>(to: To, from: [...From]): To & UnionToIntersection<From[number]>;
|
|
6124
6241
|
};
|
|
6125
6242
|
/**
|
|
6126
6243
|
* Options for merging values
|
|
@@ -6165,7 +6282,7 @@ export type Merger = {
|
|
|
6165
6282
|
* @param values Values to merge
|
|
6166
6283
|
* @returns Merged value
|
|
6167
6284
|
*/
|
|
6168
|
-
<Values extends ArrayOrPlainObject[]>(values: Array<NestedPartial<Values[number]>>): UnionToIntersection<Values[number]>;
|
|
6285
|
+
merge<Values extends ArrayOrPlainObject[]>(values: Array<NestedPartial<Values[number]>>): UnionToIntersection<Values[number]>;
|
|
6169
6286
|
};
|
|
6170
6287
|
/**
|
|
6171
6288
|
* Assign values from one or more objects to the first one
|
|
@@ -6219,10 +6336,16 @@ type TransformCallback<Value extends PlainObject, Key extends keyof Value> = (ke
|
|
|
6219
6336
|
*/
|
|
6220
6337
|
type TransformCallbacks<Value extends PlainObject> = Partial<{ [Key in keyof Value]: (value: Value[Key]) => Value[Key]; }>;
|
|
6221
6338
|
/**
|
|
6222
|
-
* A transformer
|
|
6339
|
+
* A transformer for an object, with predefined callbacks for transforming its properties
|
|
6223
6340
|
*/
|
|
6224
6341
|
export type Transformer<Value extends PlainObject> = {
|
|
6225
|
-
|
|
6342
|
+
/**
|
|
6343
|
+
* Transform an object's properties
|
|
6344
|
+
*
|
|
6345
|
+
* @param value Object to transform
|
|
6346
|
+
* @returns Transformed object
|
|
6347
|
+
*/
|
|
6348
|
+
transform(value: Value): Value;
|
|
6226
6349
|
};
|
|
6227
6350
|
/**
|
|
6228
6351
|
* Initialize a transformer for an object with a transformer function
|
|
@@ -7498,12 +7621,12 @@ type Logger = {
|
|
|
7498
7621
|
* @param label Label for the logger
|
|
7499
7622
|
* @returns _TimedLogger_ instance
|
|
7500
7623
|
*/
|
|
7501
|
-
time(label: string):
|
|
7624
|
+
time(label: string): TimeLogger;
|
|
7502
7625
|
};
|
|
7503
7626
|
/**
|
|
7504
7627
|
* A named timer that can be used to log durations to the console
|
|
7505
7628
|
*/
|
|
7506
|
-
type
|
|
7629
|
+
type TimeLogger = {
|
|
7507
7630
|
/**
|
|
7508
7631
|
* Is the timer active? _(i.e. has it been started and not stopped, and is logging enabled?)_
|
|
7509
7632
|
*/
|
|
@@ -7519,8 +7642,9 @@ type TimedLogger = {
|
|
|
7519
7642
|
*/
|
|
7520
7643
|
get stop(): () => void;
|
|
7521
7644
|
};
|
|
7645
|
+
declare function TimeLogger(this: any, label: string): void;
|
|
7522
7646
|
declare function isLogger(value: unknown): value is Logger;
|
|
7523
|
-
declare function
|
|
7647
|
+
declare function isTimeLogger(value: unknown): value is TimeLogger;
|
|
7524
7648
|
/**
|
|
7525
7649
|
* A logger that can be used to log messages to the console
|
|
7526
7650
|
*
|
|
@@ -8202,4 +8326,4 @@ export declare class SizedSet<Value = unknown> extends Set<Value> {
|
|
|
8202
8326
|
get(value: Value, update?: boolean): Value | undefined;
|
|
8203
8327
|
}
|
|
8204
8328
|
//#endregion
|
|
8205
|
-
export { type Color, type ColorType, type ColorTypeExtended, type ColorValue, type ColorValueExtended, type HSLAColor, type HSLColor, type HWBAColor, type HWBColor, Key$1 as Key, Logger, type RGBAColor, type RGBColor, type Shaken, type Smushed, type Subscription, type SubscriptionParameters, type SubscriptionProperty, type Subscriptions, type SubscriptionsParameters, type
|
|
8329
|
+
export { type AsyncLimiter, type Color, type ColorType, type ColorTypeExtended, type ColorValue, type ColorValueExtended, type HSLAColor, type HSLColor, type HWBAColor, type HWBColor, Key$1 as Key, type Limiter, Logger, Once, OnceAsync, type RGBAColor, type RGBColor, type Shaken, type Smushed, type Subscription, type SubscriptionParameters, type SubscriptionProperty, type Subscriptions, type SubscriptionsParameters, type TimeLogger, type Unsmushed, toPromise as fromResult, getRandomFloatingNumber as getRandomFloat, isLogger, isTimeLogger };
|