@oscarpalmer/atoms 0.198.0 → 0.200.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/flatten.d.mts +1 -1
- package/dist/array/from.d.mts +1 -1
- package/dist/array/group-by.d.mts +2 -2
- package/dist/array/sort.d.mts +4 -0
- package/dist/array/to-map.d.mts +2 -2
- package/dist/array/to-record.d.mts +2 -2
- package/dist/beacon.mjs +46 -43
- package/dist/color/instance.mjs +14 -10
- package/dist/function/retry.mjs +6 -8
- package/dist/index.d.mts +153 -53
- package/dist/index.mjs +347 -259
- package/dist/internal/array/compact.d.mts +2 -2
- package/dist/internal/array/find.d.mts +2 -2
- package/dist/internal/array/find.mjs +11 -11
- package/dist/internal/function/memoize.mjs +4 -3
- package/dist/internal/function/timer.mjs +3 -5
- package/dist/internal/herald.mjs +26 -23
- package/dist/internal/subscription.d.mts +72 -16
- package/dist/internal/subscription.mjs +94 -29
- package/dist/internal/value/compare.mjs +2 -2
- package/dist/internal/value/equal.mjs +30 -30
- package/dist/internal/value/handlers.d.mts +3 -3
- package/dist/internal/value/handlers.mjs +6 -6
- package/dist/promise/constants.d.mts +3 -1
- package/dist/promise/constants.mjs +3 -1
- package/dist/promise/delay.mjs +2 -2
- package/dist/promise/helpers.d.mts +4 -5
- package/dist/promise/helpers.mjs +13 -5
- package/dist/promise/index.d.mts +34 -36
- package/dist/promise/index.mjs +28 -23
- package/dist/promise/misc.mjs +2 -2
- package/dist/promise/models.d.mts +7 -6
- package/dist/promise/timed.mjs +2 -2
- package/dist/queue.d.mts +4 -0
- package/dist/queue.mjs +3 -3
- package/dist/string/fuzzy.d.mts +2 -0
- package/dist/string/fuzzy.mjs +20 -18
- package/dist/string/normalize.mjs +12 -12
- package/dist/string/template.mjs +8 -8
- package/dist/subscription.d.mts +2 -2
- package/dist/subscription.mjs +2 -2
- package/dist/value/clone.mjs +13 -13
- package/dist/value/freeze.d.mts +2 -0
- package/dist/value/freeze.mjs +2 -0
- package/dist/value/merge.d.mts +1 -1
- package/dist/value/merge.mjs +7 -6
- package/package.json +4 -4
- package/plugin/index.js +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -604,7 +604,7 @@ export declare namespace groupBy {
|
|
|
604
604
|
* // }
|
|
605
605
|
* ```
|
|
606
606
|
*/
|
|
607
|
-
export declare function groupArraysBy<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, ReturnType<ValueCallback
|
|
607
|
+
export declare function groupArraysBy<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, Array<ReturnType<ValueCallback>>>;
|
|
608
608
|
/**
|
|
609
609
|
* Create a record from an array of items using a specific key and value, grouping values into arrays
|
|
610
610
|
*
|
|
@@ -650,7 +650,7 @@ export declare function groupArraysBy<Item extends PlainObject, KeyCallback exte
|
|
|
650
650
|
* // }
|
|
651
651
|
* ```
|
|
652
652
|
*/
|
|
653
|
-
export declare function groupArraysBy<Item extends PlainObject, ItemKey extends keyof Item, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, value: ValueCallback): Simplify<Record<KeyedValue<Item, ItemKey>, ReturnType<ValueCallback
|
|
653
|
+
export declare function groupArraysBy<Item extends PlainObject, ItemKey extends keyof Item, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, value: ValueCallback): Simplify<Record<KeyedValue<Item, ItemKey>, Array<ReturnType<ValueCallback>>>>;
|
|
654
654
|
/**
|
|
655
655
|
* Create a record from an array of items using a specific key and value, grouping values into arrays
|
|
656
656
|
*
|
|
@@ -745,7 +745,7 @@ export declare function chunk<Item>(array: Item[], size?: number): Item[][];
|
|
|
745
745
|
* compact([0, 1, '', 'hello', false, true, null, undefined]); // => [1, 'hello', true]
|
|
746
746
|
* ```
|
|
747
747
|
*/
|
|
748
|
-
export declare function compact<Item>(array: Item[], strict: true): Exclude<Item, 0 | '' | false | null | undefined
|
|
748
|
+
export declare function compact<Item>(array: Item[], strict: true): Array<Exclude<Item, 0 | '' | false | null | undefined>>;
|
|
749
749
|
/**
|
|
750
750
|
* Compact an array _(removing all `null` and `undefined` values)_
|
|
751
751
|
*
|
|
@@ -757,7 +757,7 @@ export declare function compact<Item>(array: Item[], strict: true): Exclude<Item
|
|
|
757
757
|
* compact([0, 1, '', 'hello', false, true, null, undefined]); // => [0, 1, '', 'hello', false, true]
|
|
758
758
|
* ```
|
|
759
759
|
*/
|
|
760
|
-
export declare function compact<Item>(array: Item[]): Exclude<Item, null | undefined
|
|
760
|
+
export declare function compact<Item>(array: Item[]): Array<Exclude<Item, null | undefined>>;
|
|
761
761
|
//#endregion
|
|
762
762
|
//#region src/internal/array/get.d.ts
|
|
763
763
|
/**
|
|
@@ -1516,7 +1516,7 @@ export declare function findLast<Item>(array: Item[], value: Item): Item | undef
|
|
|
1516
1516
|
* flatten([1, [2, [3, 4], 5], 6]); // => [1, 2, 3, 4, 5, 6]
|
|
1517
1517
|
* ```
|
|
1518
1518
|
*/
|
|
1519
|
-
export declare function flatten<Item>(array: Item[]): NestedArray<Item
|
|
1519
|
+
export declare function flatten<Item>(array: Item[]): Array<NestedArray<Item>>;
|
|
1520
1520
|
//#endregion
|
|
1521
1521
|
//#region src/array/from.d.ts
|
|
1522
1522
|
/**
|
|
@@ -1582,7 +1582,7 @@ export declare function times(length: number): number[];
|
|
|
1582
1582
|
* times(5, index => index * 2); // => [0, 2, 4, 6, 8]
|
|
1583
1583
|
* ```
|
|
1584
1584
|
*/
|
|
1585
|
-
export declare function times<Callback extends (index: number) => unknown>(length: number, callback: Callback): ReturnType<Callback
|
|
1585
|
+
export declare function times<Callback extends (index: number) => unknown>(length: number, callback: Callback): Array<ReturnType<Callback>>;
|
|
1586
1586
|
/**
|
|
1587
1587
|
* Get an array with a specified length, filled with a specified value
|
|
1588
1588
|
*
|
|
@@ -3017,6 +3017,8 @@ export declare function initializeSorter<Item>(descending?: boolean): Sorter<Ite
|
|
|
3017
3017
|
/**
|
|
3018
3018
|
* Is the array sorted according to the sorters _(and the optional default direction)_?
|
|
3019
3019
|
*
|
|
3020
|
+
* _Available as `isSorted` and `sort.is`_
|
|
3021
|
+
*
|
|
3020
3022
|
* @param array Array to check
|
|
3021
3023
|
* @param sorters Sorters to determine sorting
|
|
3022
3024
|
* @param descending Sorted in descending order? _(defaults to `false`; overridden by individual sorters)_
|
|
@@ -3026,6 +3028,8 @@ export declare function isSorted<Item>(array: Item[], sorters: Array<ArraySorter
|
|
|
3026
3028
|
/**
|
|
3027
3029
|
* Is the array sorted according to the sorter _(and the optional default direction)_?
|
|
3028
3030
|
*
|
|
3031
|
+
* _Available as `isSorted` and `sort.is`_
|
|
3032
|
+
*
|
|
3029
3033
|
* @param array Array to check
|
|
3030
3034
|
* @param sorter Sorter to determine sorting
|
|
3031
3035
|
* @param descending Sorted in descending order? _(defaults to `false`; overridden by individual sorters)_
|
|
@@ -3430,7 +3434,7 @@ export declare namespace toMap {
|
|
|
3430
3434
|
* ); // => Map { 10 => [1, 3], 20 => [2] }
|
|
3431
3435
|
* ```
|
|
3432
3436
|
*/
|
|
3433
|
-
export declare function toMapArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Map<ReturnType<KeyCallback>, ReturnType<ValueCallback
|
|
3437
|
+
export declare function toMapArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Map<ReturnType<KeyCallback>, Array<ReturnType<ValueCallback>>>;
|
|
3434
3438
|
/**
|
|
3435
3439
|
* Create a _Map_ from an array of items using a callback and value, grouping values into arrays
|
|
3436
3440
|
*
|
|
@@ -3470,7 +3474,7 @@ export declare function toMapArrays<Item extends PlainObject, KeyCallback extend
|
|
|
3470
3474
|
* ); // => Map { 10 => [1, 3], 20 => [2] }
|
|
3471
3475
|
* ```
|
|
3472
3476
|
*/
|
|
3473
|
-
export declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Item, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, value: ValueCallback): Map<Item[ItemKey], ReturnType<ValueCallback
|
|
3477
|
+
export declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Item, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, value: ValueCallback): Map<Item[ItemKey], Array<ReturnType<ValueCallback>>>;
|
|
3474
3478
|
/**
|
|
3475
3479
|
* Create a _Map_ from an array of items using a key and value, grouping values into arrays
|
|
3476
3480
|
*
|
|
@@ -3681,7 +3685,7 @@ export declare namespace toRecord {
|
|
|
3681
3685
|
* ); // => { 10: [1, 3], 20: [2] }
|
|
3682
3686
|
* ```
|
|
3683
3687
|
*/
|
|
3684
|
-
export declare function toRecordArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, ReturnType<ValueCallback
|
|
3688
|
+
export declare function toRecordArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, Array<ReturnType<ValueCallback>>>;
|
|
3685
3689
|
/**
|
|
3686
3690
|
* Create a record from an array of items using a callback and value, grouping values into arrays
|
|
3687
3691
|
*
|
|
@@ -3721,7 +3725,7 @@ export declare function toRecordArrays<Item extends PlainObject, Callback extend
|
|
|
3721
3725
|
* ); // => { 10: [1, 3], 20: [2] }
|
|
3722
3726
|
* ```
|
|
3723
3727
|
*/
|
|
3724
|
-
export declare function toRecordArrays<Item extends PlainObject, ItemKey extends keyof Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, callback: Callback): Simplify<Record<KeyedValue<Item, ItemKey>, ReturnType<Callback
|
|
3728
|
+
export declare function toRecordArrays<Item extends PlainObject, ItemKey extends keyof Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, callback: Callback): Simplify<Record<KeyedValue<Item, ItemKey>, Array<ReturnType<Callback>>>>;
|
|
3725
3729
|
/**
|
|
3726
3730
|
* Create a record from an array of items using a key and value, grouping values into arrays
|
|
3727
3731
|
*
|
|
@@ -5008,7 +5012,7 @@ export type FulfilledPromise<Value> = {
|
|
|
5008
5012
|
};
|
|
5009
5013
|
export type PromiseData = {
|
|
5010
5014
|
last: number;
|
|
5011
|
-
result:
|
|
5015
|
+
result: ArrayOrPlainObject;
|
|
5012
5016
|
};
|
|
5013
5017
|
export type PromiseHandlers = {
|
|
5014
5018
|
resolve: (value: unknown[]) => void;
|
|
@@ -5033,6 +5037,7 @@ export type PromiseParameters = {
|
|
|
5033
5037
|
data: PromiseData;
|
|
5034
5038
|
handlers: PromiseHandlers;
|
|
5035
5039
|
index: number;
|
|
5040
|
+
key: Key$1;
|
|
5036
5041
|
value?: unknown;
|
|
5037
5042
|
};
|
|
5038
5043
|
/**
|
|
@@ -5048,7 +5053,7 @@ export type PromiseStrategy = 'complete' | 'first';
|
|
|
5048
5053
|
export declare class PromiseTimeoutError extends Error {
|
|
5049
5054
|
constructor();
|
|
5050
5055
|
}
|
|
5051
|
-
export type PromisesItems<Items extends
|
|
5056
|
+
export type PromisesItems<Items extends ArrayOrPlainObject> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends GenericCallback ? ReturnType<Items[ItemsKey]> extends Promise<infer Value> ? Promise<Value> : never : Items[ItemsKey] extends Promise<infer Value> ? Promise<Value> : Promise<Items[ItemsKey]>; };
|
|
5052
5057
|
/**
|
|
5053
5058
|
* Options for handling multiple _Promises_
|
|
5054
5059
|
*/
|
|
@@ -5062,10 +5067,10 @@ export type PromisesOptions = {
|
|
|
5062
5067
|
*/
|
|
5063
5068
|
strategy?: PromiseStrategy;
|
|
5064
5069
|
};
|
|
5065
|
-
export type PromisesResult<Items extends
|
|
5066
|
-
export type PromisesUnwrapped<Items extends
|
|
5070
|
+
export type PromisesResult<Items extends ArrayOrPlainObject> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends Promise<infer Value> ? Result<Awaited<Value>> : never; };
|
|
5071
|
+
export type PromisesUnwrapped<Items extends ArrayOrPlainObject> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends GenericCallback ? ReturnType<Items[ItemsKey]> extends Promise<infer Value> ? Awaited<Value> : never : Items[ItemsKey] extends Promise<infer Value> ? Awaited<Value> : never; };
|
|
5067
5072
|
export type PromisesValue<Value> = FulfilledPromise<Value> | RejectedPromise;
|
|
5068
|
-
export type PromisesValues<Items extends
|
|
5073
|
+
export type PromisesValues<Items extends ArrayOrPlainObject> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends Promise<infer Value> ? PromisesValue<Awaited<Value>> : never; };
|
|
5069
5074
|
/**
|
|
5070
5075
|
* A _Promise_ that was rejected
|
|
5071
5076
|
*/
|
|
@@ -5098,7 +5103,7 @@ export declare function delay(time?: number): Promise<void>;
|
|
|
5098
5103
|
//#endregion
|
|
5099
5104
|
//#region src/promise/index.d.ts
|
|
5100
5105
|
/**
|
|
5101
|
-
* Wrap a _Promise_ with safety handlers
|
|
5106
|
+
* Wrap a _Promise_ with safety handlers
|
|
5102
5107
|
*
|
|
5103
5108
|
* @param promise _Promise_ to wrap
|
|
5104
5109
|
* @param options Options for the _Promise_
|
|
@@ -5106,7 +5111,7 @@ export declare function delay(time?: number): Promise<void>;
|
|
|
5106
5111
|
*/
|
|
5107
5112
|
export declare function attemptPromise<Value>(promise: Promise<Value>, options?: PromiseOptions | AbortSignal | number): Promise<Value>;
|
|
5108
5113
|
/**
|
|
5109
|
-
* Wrap a _Promise_-returning callback with safety handlers
|
|
5114
|
+
* Wrap a _Promise_-returning callback with safety handlers
|
|
5110
5115
|
*
|
|
5111
5116
|
* @param callback Callback to wrap
|
|
5112
5117
|
* @param options Options for the _Promise_
|
|
@@ -5114,7 +5119,7 @@ export declare function attemptPromise<Value>(promise: Promise<Value>, options?:
|
|
|
5114
5119
|
*/
|
|
5115
5120
|
export declare function attemptPromise<Value>(callback: () => Promise<Value>, options?: PromiseOptions | AbortSignal | number): Promise<Value>;
|
|
5116
5121
|
/**
|
|
5117
|
-
* Wrap a callback with a _Promise_ and safety handlers
|
|
5122
|
+
* Wrap a callback with a _Promise_ and safety handlers
|
|
5118
5123
|
*
|
|
5119
5124
|
* @param callback Callback to wrap
|
|
5120
5125
|
* @param options Options for the _Promise_
|
|
@@ -5124,7 +5129,7 @@ export declare function attemptPromise<Value>(callback: () => Value, options?: P
|
|
|
5124
5129
|
/**
|
|
5125
5130
|
* Handle a list of _Promises_, returning their results in an ordered array
|
|
5126
5131
|
*
|
|
5127
|
-
*
|
|
5132
|
+
* _Depending on the strategy, the function will either reject on the first error encountered or return an array of rejected and resolved results_
|
|
5128
5133
|
*
|
|
5129
5134
|
* @param items List of _Promises_
|
|
5130
5135
|
* @param options Options for handling the _Promises_
|
|
@@ -5132,78 +5137,76 @@ export declare function attemptPromise<Value>(callback: () => Value, options?: P
|
|
|
5132
5137
|
*/
|
|
5133
5138
|
export declare function promises<Items extends unknown[], Options extends PromisesOptions>(items: [...Items], options?: Options): Promise<Options['strategy'] extends 'first' ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
|
|
5134
5139
|
/**
|
|
5135
|
-
* Handle
|
|
5140
|
+
* Handle keyed _Promises_, returning their results in a similarly keyed object
|
|
5136
5141
|
*
|
|
5137
|
-
*
|
|
5142
|
+
* _Depending on the strategy, the function will either reject on the first error encountered or return an object of rejected and resolved results_
|
|
5138
5143
|
*
|
|
5139
|
-
* @param items
|
|
5144
|
+
* @param items Keyed _Promises_
|
|
5140
5145
|
* @param options Options for handling the _Promises_
|
|
5141
|
-
* @returns
|
|
5146
|
+
* @returns Keyed object of results
|
|
5142
5147
|
*/
|
|
5143
|
-
export declare function promises<
|
|
5148
|
+
export declare function promises<Items extends PlainObject, Options extends PromisesOptions>(items: Items, options?: Options): Promise<Options['strategy'] extends 'first' ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
|
|
5144
5149
|
/**
|
|
5145
5150
|
* Handle a list of _Promises_, returning their results in an ordered array
|
|
5146
5151
|
*
|
|
5147
|
-
*
|
|
5152
|
+
* _If the strategy is `first`, the function will reject on the first error encountered; otherwise, it returns an array of rejected and resolved results_
|
|
5148
5153
|
*
|
|
5149
5154
|
* @param items List of _Promises_
|
|
5150
|
-
* @param strategy Strategy for handling the _Promises_
|
|
5155
|
+
* @param strategy Strategy for handling the _Promises_
|
|
5151
5156
|
* @returns List of results
|
|
5152
5157
|
*/
|
|
5153
|
-
export declare function promises<Items extends unknown[]>(items: [...Items], strategy:
|
|
5158
|
+
export declare function promises<Items extends unknown[], Strategy extends PromiseStrategy>(items: [...Items], strategy: Strategy): Promise<Strategy extends 'first' ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
|
|
5154
5159
|
/**
|
|
5155
|
-
* Handle
|
|
5160
|
+
* Handle keyed _Promises_, returning their results in a similarly keyed object
|
|
5156
5161
|
*
|
|
5157
|
-
*
|
|
5162
|
+
* _If the strategy is `first`, the function will reject on the first error encountered; otherwise, it returns an object of rejected and resolved results_
|
|
5158
5163
|
*
|
|
5159
|
-
* @param items
|
|
5160
|
-
* @param strategy Strategy for handling the _Promises_
|
|
5161
|
-
* @returns
|
|
5164
|
+
* @param items Keyed _Promises_
|
|
5165
|
+
* @param strategy Strategy for handling the _Promises_
|
|
5166
|
+
* @returns Keyed object of results
|
|
5162
5167
|
*/
|
|
5163
|
-
export declare function promises<
|
|
5168
|
+
export declare function promises<Items extends PlainObject, Strategy extends PromiseStrategy>(items: Items, strategy: Strategy): Promise<Strategy extends 'first' ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
|
|
5164
5169
|
/**
|
|
5165
|
-
* Handle a list of _Promises_, returning their results in an ordered array
|
|
5170
|
+
* Handle a list of _Promises_, returning their results in an ordered array
|
|
5166
5171
|
*
|
|
5167
5172
|
* @param items List of _Promises_
|
|
5168
|
-
* @param signal
|
|
5173
|
+
* @param signal _AbortSignal_ for aborting all _Promises_
|
|
5169
5174
|
* @returns List of results
|
|
5170
5175
|
*/
|
|
5171
5176
|
export declare function promises<Items extends unknown[]>(items: [...Items], signal?: AbortSignal): Promise<PromisesValues<PromisesItems<Items>>>;
|
|
5172
5177
|
/**
|
|
5173
|
-
* Handle
|
|
5178
|
+
* Handle keyed _Promises_, returning their results in a similarly keyed object
|
|
5174
5179
|
*
|
|
5175
|
-
* @param items
|
|
5176
|
-
* @param signal
|
|
5177
|
-
* @returns
|
|
5180
|
+
* @param items Keyed _Promises_
|
|
5181
|
+
* @param signal _AbortSignal_ for aborting all _Promises_
|
|
5182
|
+
* @returns Keyed object of results
|
|
5178
5183
|
*/
|
|
5179
|
-
export declare function promises<
|
|
5184
|
+
export declare function promises<Items extends PlainObject>(items: Items, signal?: AbortSignal): Promise<PromisesValues<PromisesItems<Items>>>;
|
|
5180
5185
|
export declare namespace promises {
|
|
5181
5186
|
var result: typeof resultPromises;
|
|
5182
5187
|
}
|
|
5183
5188
|
/**
|
|
5184
5189
|
* Handle a list of _Promises_, returning their results in an ordered array of results _({@link Result})_
|
|
5185
5190
|
*
|
|
5186
|
-
*
|
|
5191
|
+
* _Depending on the strategy, the function will either reject on the first error encountered or return an array of rejected and resolved results_
|
|
5187
5192
|
*
|
|
5188
5193
|
* _Available as `resultPromises` and `promises.result`_
|
|
5189
5194
|
*
|
|
5190
5195
|
* @param items List of _Promises_
|
|
5191
|
-
* @param signal AbortSignal for aborting
|
|
5196
|
+
* @param signal AbortSignal for aborting all _Promises_
|
|
5192
5197
|
* @returns List of results
|
|
5193
5198
|
*/
|
|
5194
5199
|
export declare function resultPromises<Items extends unknown[]>(items: [...Items], signal?: AbortSignal): Promise<PromisesResult<PromisesItems<Items>>>;
|
|
5195
5200
|
/**
|
|
5196
|
-
* Handle
|
|
5197
|
-
*
|
|
5198
|
-
* Depending on the strategy, the function will either reject on the first error encountered or return an array of rejected and resolved results
|
|
5201
|
+
* Handle keyed _Promises_, returning their results in a similarly keyed object of results _({@link Result})_
|
|
5199
5202
|
*
|
|
5200
5203
|
* _Available as `resultPromises` and `promises.result`_
|
|
5201
5204
|
*
|
|
5202
|
-
* @param items
|
|
5203
|
-
* @param signal AbortSignal for aborting
|
|
5204
|
-
* @returns
|
|
5205
|
+
* @param items Keyed _Promises_
|
|
5206
|
+
* @param signal AbortSignal for aborting all _Promises_
|
|
5207
|
+
* @returns Keyed object of results
|
|
5205
5208
|
*/
|
|
5206
|
-
export declare function resultPromises<
|
|
5209
|
+
export declare function resultPromises<Items extends PlainObject>(items: Items, signal?: AbortSignal): Promise<PromisesResult<PromisesItems<Items>>>;
|
|
5207
5210
|
//#endregion
|
|
5208
5211
|
//#region src/internal/result/misc.d.ts
|
|
5209
5212
|
/**
|
|
@@ -5947,6 +5950,8 @@ export declare namespace fuzzy {
|
|
|
5947
5950
|
/**
|
|
5948
5951
|
* Does the needle match the haystack in a fuzzy way?
|
|
5949
5952
|
*
|
|
5953
|
+
* _Available as `fuzzyMatch` and `fuzzy.match`_
|
|
5954
|
+
*
|
|
5950
5955
|
* @param haystack Haystack to search through
|
|
5951
5956
|
* @param needle Needle to search for
|
|
5952
5957
|
* @returns `true` if the needle matches the haystack in a fuzzy way, otherwise `false`
|
|
@@ -6486,6 +6491,8 @@ export declare namespace freeze {
|
|
|
6486
6491
|
/**
|
|
6487
6492
|
* Is the value frozen?
|
|
6488
6493
|
*
|
|
6494
|
+
* _Available as `isFrozen` and `freeze.is`_
|
|
6495
|
+
*
|
|
6489
6496
|
* @param value Value to check
|
|
6490
6497
|
* @returns `true` if the value is frozen, otherwise `false`
|
|
6491
6498
|
*/
|
|
@@ -6615,7 +6622,7 @@ export type Merger = {
|
|
|
6615
6622
|
* @param values Values to merge
|
|
6616
6623
|
* @returns Merged value
|
|
6617
6624
|
*/
|
|
6618
|
-
<Values extends ArrayOrPlainObject[]>(values: NestedPartial<Values[number]
|
|
6625
|
+
<Values extends ArrayOrPlainObject[]>(values: Array<NestedPartial<Values[number]>>): UnionToIntersection<Values[number]>;
|
|
6619
6626
|
};
|
|
6620
6627
|
/**
|
|
6621
6628
|
* Assign values from one or more objects to the first one
|
|
@@ -6723,6 +6730,27 @@ type Subscription = {
|
|
|
6723
6730
|
*/
|
|
6724
6731
|
unsubscribe(): void;
|
|
6725
6732
|
};
|
|
6733
|
+
/**
|
|
6734
|
+
* Parameters for creating a subscription
|
|
6735
|
+
*/
|
|
6736
|
+
type SubscriptionParameters = {
|
|
6737
|
+
/**
|
|
6738
|
+
* Is the owner of the subscription alive? _(defaults to `true`)_
|
|
6739
|
+
*/
|
|
6740
|
+
isActive?: () => boolean;
|
|
6741
|
+
/**
|
|
6742
|
+
* Key used to identify a subscription _(defaults to `undefined`)_
|
|
6743
|
+
*/
|
|
6744
|
+
key?: unknown;
|
|
6745
|
+
/**
|
|
6746
|
+
* Signal used to abort the subscription _(defaults to `undefined`)_
|
|
6747
|
+
*/
|
|
6748
|
+
signal?: AbortSignal;
|
|
6749
|
+
/**
|
|
6750
|
+
* Value used to identify a subscription
|
|
6751
|
+
*/
|
|
6752
|
+
value: unknown;
|
|
6753
|
+
};
|
|
6726
6754
|
/**
|
|
6727
6755
|
* Property information for subscription identification
|
|
6728
6756
|
*/
|
|
@@ -6732,9 +6760,63 @@ type SubscriptionProperty = {
|
|
|
6732
6760
|
*/
|
|
6733
6761
|
key: string;
|
|
6734
6762
|
/**
|
|
6735
|
-
* Value of the property used to identify a subscription
|
|
6763
|
+
* Value of the property used to identify a subscription
|
|
6736
6764
|
*/
|
|
6737
|
-
value
|
|
6765
|
+
value: unknown;
|
|
6766
|
+
};
|
|
6767
|
+
type Subscriptions = {
|
|
6768
|
+
/**
|
|
6769
|
+
* Items of the subscriptions store
|
|
6770
|
+
*
|
|
6771
|
+
* - `any` - Set of subscriptions _(for unkeyed subscriptions)_
|
|
6772
|
+
* - `keyed` - Map of keys to sets of subscriptions _(for keyed subscriptions)_
|
|
6773
|
+
*/
|
|
6774
|
+
readonly items: Readonly<SubscriptionsItems>;
|
|
6775
|
+
/**
|
|
6776
|
+
* Values of the subscriptions store
|
|
6777
|
+
*
|
|
6778
|
+
* - `from.any` - Map of values to subscriptions _(for unkeyed subscriptions)_
|
|
6779
|
+
* - `from.keyed` - Map of keys to maps of values to subscriptions _(for keyed subscriptions)_
|
|
6780
|
+
* - `to.any` - Map of subscriptions to values _(for unkeyed subscriptions)_
|
|
6781
|
+
* - `to.keyed` - Map of keys to maps of subscriptions to values _(for keyed subscriptions)_
|
|
6782
|
+
*/
|
|
6783
|
+
readonly values: Readonly<SubscriptionsValues>;
|
|
6784
|
+
/**
|
|
6785
|
+
* Clear all subscriptions
|
|
6786
|
+
*/
|
|
6787
|
+
clear: () => void;
|
|
6788
|
+
/**
|
|
6789
|
+
* Create _(or retrieve)_ a subscription
|
|
6790
|
+
*
|
|
6791
|
+
* @param parameters Subscription parameters
|
|
6792
|
+
* @returns Tuple holding subsccription and existing boolean
|
|
6793
|
+
*/
|
|
6794
|
+
create: (parameters: SubscriptionParameters) => [Subscription, boolean];
|
|
6795
|
+
};
|
|
6796
|
+
/**
|
|
6797
|
+
* Parameters for creating a subscription store
|
|
6798
|
+
*/
|
|
6799
|
+
type SubscriptionsParameters = {
|
|
6800
|
+
/**
|
|
6801
|
+
* Allow any or specific keys for subscriptions? _(defaults to `false`, which prevents keyed subscriptions)_
|
|
6802
|
+
*/
|
|
6803
|
+
keys?: boolean | Set<Key$1>;
|
|
6804
|
+
/**
|
|
6805
|
+
* Property information for subscription identification
|
|
6806
|
+
*/
|
|
6807
|
+
property?: SubscriptionProperty;
|
|
6808
|
+
};
|
|
6809
|
+
type SubscriptionsItems = {
|
|
6810
|
+
any: Set<Subscription>;
|
|
6811
|
+
keyed?: Map<Key$1, Set<Subscription>>;
|
|
6812
|
+
};
|
|
6813
|
+
type SubscriptionsValues = {
|
|
6814
|
+
from: SubscriptionsValuesItem<unknown, Subscription>;
|
|
6815
|
+
to: SubscriptionsValuesItem<Subscription, unknown>;
|
|
6816
|
+
};
|
|
6817
|
+
type SubscriptionsValuesItem<MapKey, MapValue> = {
|
|
6818
|
+
any: Map<MapKey, MapValue>;
|
|
6819
|
+
keyed?: Map<Key$1, Map<MapKey, MapValue>>;
|
|
6738
6820
|
};
|
|
6739
6821
|
/**
|
|
6740
6822
|
* Is the value a subscription?
|
|
@@ -6743,6 +6825,20 @@ type SubscriptionProperty = {
|
|
|
6743
6825
|
* @returns `true` if the value is a subscription, otherwise `false`
|
|
6744
6826
|
*/
|
|
6745
6827
|
export declare function isSubscription(value: unknown): value is Subscription;
|
|
6828
|
+
/**
|
|
6829
|
+
* Is the value a subscriptions store?
|
|
6830
|
+
*
|
|
6831
|
+
* @param value Value to check
|
|
6832
|
+
* @returns `true` if the value is a subscriptions store, otherwise `false`
|
|
6833
|
+
*/
|
|
6834
|
+
export declare function isSubscriptions(value: unknown): value is Subscriptions;
|
|
6835
|
+
/**
|
|
6836
|
+
* Create a subscription store
|
|
6837
|
+
*
|
|
6838
|
+
* @param parameters Store parameters
|
|
6839
|
+
* @returns Subscription store
|
|
6840
|
+
*/
|
|
6841
|
+
export declare function subscriptions(parameters?: SubscriptionsParameters): Subscriptions;
|
|
6746
6842
|
//#endregion
|
|
6747
6843
|
//#region src/beacon.d.ts
|
|
6748
6844
|
/**
|
|
@@ -8410,6 +8506,8 @@ export declare function isQueueInstance<Instance>(name: string, value: unknown):
|
|
|
8410
8506
|
/**
|
|
8411
8507
|
* Create a keyed queue for an asynchronous callback function, where each key has its own queue
|
|
8412
8508
|
*
|
|
8509
|
+
* _Available as `keyedQueue` and `queue.keyed`_
|
|
8510
|
+
*
|
|
8413
8511
|
* @param callback Callback function for queued items
|
|
8414
8512
|
* @param options Queue options
|
|
8415
8513
|
*/
|
|
@@ -8417,6 +8515,8 @@ export declare function keyedQueue<Callback extends (key: string, ...parameters:
|
|
|
8417
8515
|
/**
|
|
8418
8516
|
* Create a keyed queue for an asynchronous callback function, where each key has its own queue
|
|
8419
8517
|
*
|
|
8518
|
+
* _Available as `keyedQueue` and `queue.keyed`_
|
|
8519
|
+
*
|
|
8420
8520
|
* @param callback Callback function for queued items
|
|
8421
8521
|
* @param options Queue options
|
|
8422
8522
|
*/
|
|
@@ -8559,4 +8659,4 @@ export declare class SizedSet<Value = unknown> extends Set<Value> {
|
|
|
8559
8659
|
get(value: Value, update?: boolean): Value | undefined;
|
|
8560
8660
|
}
|
|
8561
8661
|
//#endregion
|
|
8562
|
-
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 TimedLogger, type Unsmushed, toPromise as fromResult, getRandomFloatingNumber as getRandomFloat, isLogger, isTimedLogger };
|
|
8662
|
+
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 TimedLogger, type Unsmushed, toPromise as fromResult, getRandomFloatingNumber as getRandomFloat, isLogger, isTimedLogger };
|