@andrew_l/toolkit 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +250 -109
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +484 -422
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -131,6 +131,189 @@ declare function chunkSeries(list: readonly number[], step?: number): number[][]
|
|
|
131
131
|
* @group Array
|
|
132
132
|
*/
|
|
133
133
|
declare function difference<T>(...arrays: (readonly T[])[]): T[];
|
|
134
|
+
/**
|
|
135
|
+
* Source: https://github.com/kourge/ts-brand/blob/master/src/index.ts
|
|
136
|
+
*/
|
|
137
|
+
/**
|
|
138
|
+
* A `Brand` is a type that takes at minimum two type parameters. Given a base
|
|
139
|
+
* type `Base` and some unique and arbitrary branding type `Branding`, it
|
|
140
|
+
* produces a type based on but distinct from `Base`. The resulting branded
|
|
141
|
+
* type is not directly assignable from the base type, and not mutually
|
|
142
|
+
* assignable with another branded type derived from the same base type.
|
|
143
|
+
*
|
|
144
|
+
* Take care that the branding type is unique. Two branded types that share the
|
|
145
|
+
* same base type and branding type are considered the same type! There are two
|
|
146
|
+
* ways to avoid this.
|
|
147
|
+
*
|
|
148
|
+
* The first way is to supply a third type parameter, `ReservedName`, with a
|
|
149
|
+
* string literal type that is not `__type__`, which is the default.
|
|
150
|
+
*
|
|
151
|
+
* The second way is to define a branded type in terms of its surrounding
|
|
152
|
+
* interface, thereby forming a recursive type. This is possible because there
|
|
153
|
+
* are no constraints on what the branding type must be. It does not have to
|
|
154
|
+
* be a string literal type, even though it often is.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```
|
|
158
|
+
* type Path = Brand<string, 'path'>;
|
|
159
|
+
* type UserId = Brand<number, 'user'>;
|
|
160
|
+
* type DifferentUserId = Brand<number, 'user', '__kind__'>;
|
|
161
|
+
* interface Post { id: Brand<number, Post> }
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
type Brand<Base, Branding, ReservedName extends string = '__type__'> = Base & { [K in ReservedName]: Branding } & {
|
|
165
|
+
__witness__: Base;
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* An `AnyBrand` is a branded type based on any base type branded with any
|
|
169
|
+
* branding type. By itself it is not useful, but it can act as type constraint
|
|
170
|
+
* when manipulating branded types in general.
|
|
171
|
+
*/
|
|
172
|
+
type AnyBrand = Brand<unknown, any>;
|
|
173
|
+
/**
|
|
174
|
+
* `BrandTypeOf` is a type that takes any branded type `B` and yields its base type.
|
|
175
|
+
*/
|
|
176
|
+
type BrandTypeOf<B extends AnyBrand> = B['__witness__'];
|
|
177
|
+
type Arrayable<T> = T[] | T;
|
|
178
|
+
type Awaitable<T> = Promise<T> | T;
|
|
179
|
+
type ArgumentsType<T> = T extends ((...args: infer U) => any) ? U : never;
|
|
180
|
+
type FunctionArgs<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
|
|
181
|
+
type DeepPartial<T> = T extends Date ? T : T extends object ? { [P in keyof T]?: DeepPartial<T[P]> } : T;
|
|
182
|
+
type DeepReadonly<T> = T extends unknown[] ? Readonly<T> : T extends object ? Readonly<{ [P in keyof T]: DeepReadonly<T[P]> }> : Readonly<T>;
|
|
183
|
+
type AnyFunction = (...args: any[]) => any;
|
|
184
|
+
type Data = Record<string, unknown>;
|
|
185
|
+
type GenericObject = Record<string, any>;
|
|
186
|
+
interface SelectOptionItem<T = any> {
|
|
187
|
+
text: string;
|
|
188
|
+
value: T;
|
|
189
|
+
props?: any;
|
|
190
|
+
}
|
|
191
|
+
type SelectOptions<T = any> = SelectOptionItem<T>[];
|
|
192
|
+
type OverwriteWith<T1, T2> = IsAny<T2> extends true ? T1 : Omit<T1, keyof T2> & T2;
|
|
193
|
+
type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false;
|
|
194
|
+
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
195
|
+
/**
|
|
196
|
+
* @example
|
|
197
|
+
* LiteralUnion<'foo' | 'bar', string>
|
|
198
|
+
*
|
|
199
|
+
* @see {@link https://github.com/microsoft/TypeScript/issues/29729}
|
|
200
|
+
*/
|
|
201
|
+
type LiteralUnion<Union, Type> = Union | (Type & Nothing);
|
|
202
|
+
interface Nothing {}
|
|
203
|
+
type ValuesOfObject<T> = T[keyof T];
|
|
204
|
+
type Fn$1 = () => void;
|
|
205
|
+
type PromisifyFn<T extends AnyFunction> = (...args: ArgumentsType<T>) => Promise<ReturnType<T>>;
|
|
206
|
+
/**
|
|
207
|
+
* A time value, which can be a string (e.g., "HH:MM"),
|
|
208
|
+
* an object with `h` (hours) and `m` (minutes) properties, or a similar format
|
|
209
|
+
* that `createTimeObject` can parse.
|
|
210
|
+
*/
|
|
211
|
+
type TimeValue = TimeString | TimeObject;
|
|
212
|
+
/**
|
|
213
|
+
* Represent time string in 24h format
|
|
214
|
+
*/
|
|
215
|
+
type TimeString = string;
|
|
216
|
+
/**
|
|
217
|
+
* Represent time object in 24h format ("HH:MM")
|
|
218
|
+
*/
|
|
219
|
+
type TimeObject = {
|
|
220
|
+
/**
|
|
221
|
+
* Hour (0 - 23).
|
|
222
|
+
*/
|
|
223
|
+
h: number;
|
|
224
|
+
/**
|
|
225
|
+
* Minutes (0 - 59).
|
|
226
|
+
*/
|
|
227
|
+
m: number;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Represent date object
|
|
231
|
+
*/
|
|
232
|
+
type DateObject = {
|
|
233
|
+
/**
|
|
234
|
+
* The year of the date (e.g., 2024).
|
|
235
|
+
*/
|
|
236
|
+
year: number;
|
|
237
|
+
/**
|
|
238
|
+
* The month of the date (1 = January, 12 = December).
|
|
239
|
+
*/
|
|
240
|
+
month: number;
|
|
241
|
+
/**
|
|
242
|
+
* The day of the month (1-31).
|
|
243
|
+
*/
|
|
244
|
+
date: number;
|
|
245
|
+
};
|
|
246
|
+
interface ThemeConfig {
|
|
247
|
+
colors: {
|
|
248
|
+
[x: string]: Record<string, string>;
|
|
249
|
+
};
|
|
250
|
+
variables: {
|
|
251
|
+
[x: string]: Record<string, string | number>;
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
255
|
+
interface SelectOptionItem<T = any> {
|
|
256
|
+
text: string;
|
|
257
|
+
value: T;
|
|
258
|
+
props?: any;
|
|
259
|
+
}
|
|
260
|
+
type Primitive = null | undefined | string | number | bigint | boolean | symbol;
|
|
261
|
+
type SpecialValue = Brand<symbol, 'special-value'>;
|
|
262
|
+
type ExecResult<T extends Data = Data, K extends Data = Data> = ExecSuccess<T> | ExecSkip<K>;
|
|
263
|
+
type ExecSuccess<T extends Data = Data> = {
|
|
264
|
+
success: true;
|
|
265
|
+
code: string;
|
|
266
|
+
reason?: string;
|
|
267
|
+
} & T;
|
|
268
|
+
type ExecSkip<T extends Data = Data> = {
|
|
269
|
+
skip: true;
|
|
270
|
+
code: string;
|
|
271
|
+
reason?: string;
|
|
272
|
+
} & T;
|
|
273
|
+
type ExecResultToSuccess<T> = T extends ExecSuccess<infer X> ? ExecSuccess<X> : ExecSuccess;
|
|
274
|
+
type ExecResultToSkip<T> = T extends ExecSkip<infer X> ? ExecSkip<X> : ExecSkip;
|
|
275
|
+
interface Logger {
|
|
276
|
+
info: (...args: unknown[]) => void;
|
|
277
|
+
warn: (...args: unknown[]) => void;
|
|
278
|
+
error: (...args: unknown[]) => void;
|
|
279
|
+
debug: (...args: unknown[]) => void;
|
|
280
|
+
log: (...args: unknown[]) => void;
|
|
281
|
+
extend: (...args: unknown[]) => Logger;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Filters and maps an array in a single pass.
|
|
285
|
+
*
|
|
286
|
+
* The callback receives a `skip` sentinel as its second argument. Return any
|
|
287
|
+
* mapped value to keep it, or return `skip` to exclude the current element from
|
|
288
|
+
* the result. This avoids the extra allocation of chaining `.filter().map()`.
|
|
289
|
+
*
|
|
290
|
+
* @param array - The source array to iterate over. It is not mutated.
|
|
291
|
+
* @param callbackfn - Called for each element with `(value, skip, index, array)`.
|
|
292
|
+
* Return the mapped value to keep, or `skip` to drop the element.
|
|
293
|
+
* @returns A new array of the mapped values, excluding any skipped elements.
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```ts
|
|
297
|
+
* // Keep even numbers and double them, dropping the rest.
|
|
298
|
+
* filterMap([1, 2, 3, 4], (value, skip) =>
|
|
299
|
+
* value % 2 === 0 ? value * 2 : skip,
|
|
300
|
+
* );
|
|
301
|
+
* // => [4, 8]
|
|
302
|
+
* ```
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* ```ts
|
|
306
|
+
* // Parse valid numbers, skipping entries that fail to parse.
|
|
307
|
+
* filterMap(['1', 'x', '3'], (value, skip) => {
|
|
308
|
+
* const n = Number(value);
|
|
309
|
+
* return Number.isNaN(n) ? skip : n;
|
|
310
|
+
* });
|
|
311
|
+
* // => [1, 3]
|
|
312
|
+
* ```
|
|
313
|
+
*
|
|
314
|
+
* @group Array
|
|
315
|
+
*/
|
|
316
|
+
declare function filterMap<T, U>(array: T[], callbackfn: (value: T, skip: SpecialValue, index: number, array: T[]) => U | SpecialValue): U[];
|
|
134
317
|
type PropertyKeyLiteralToType<T> = T extends string ? string : T extends number ? number : T extends symbol ? symbol : T;
|
|
135
318
|
type IsPropertyKey<T, V, L> = T extends object ? V extends keyof T ? T[V] : L : PropertyKeyLiteralToType<L>;
|
|
136
319
|
type ToPropertyKey<T> = T extends PropertyKey ? T : string;
|
|
@@ -400,7 +583,7 @@ type WrrItem<T> = {
|
|
|
400
583
|
*/
|
|
401
584
|
declare function weightedRoundRobin<T = unknown>(arr: WrrItem<T>[]): () => T;
|
|
402
585
|
declare namespace assert_d_exports {
|
|
403
|
-
export { array, arrayNumbers, arrayStrings, boolean, date, equal, fn$1 as fn, greaterThan, lessThan, notEmpty, notEmptyString, number, object, ok, string };
|
|
586
|
+
export { array, arrayNumbers, arrayStrings, bigint, boolean, date, equal, execSkip, execSuccess, fn$1 as fn, greaterThan, lessThan, notEmpty, notEmptyString, number, object, ok, string };
|
|
404
587
|
}
|
|
405
588
|
declare function ok(value: unknown, message?: string | Error): asserts value;
|
|
406
589
|
declare function equal<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
|
@@ -410,6 +593,7 @@ declare function string(value: unknown, message?: string | Error): asserts value
|
|
|
410
593
|
declare function boolean(value: unknown, message?: string | Error): asserts value is boolean;
|
|
411
594
|
declare function notEmptyString(value: unknown, message?: string | Error): asserts value is string;
|
|
412
595
|
declare function number(value: unknown, message?: string | Error): asserts value is number;
|
|
596
|
+
declare function bigint(value: unknown, message?: string | Error): asserts value is bigint;
|
|
413
597
|
declare function date(value: unknown, message?: string | Error): asserts value is Date;
|
|
414
598
|
declare function fn$1(value: unknown, message?: string | Error): asserts value is Function;
|
|
415
599
|
declare function greaterThan(value: unknown, target: number, message?: string | Error): asserts value is number;
|
|
@@ -417,6 +601,8 @@ declare function lessThan(value: unknown, target: number, message?: string | Err
|
|
|
417
601
|
declare function array(value: unknown, message?: string | Error): asserts value is unknown[];
|
|
418
602
|
declare function arrayStrings(value: unknown, message?: string | Error): asserts value is string[];
|
|
419
603
|
declare function arrayNumbers(value: unknown, message?: string | Error): asserts value is number[];
|
|
604
|
+
declare function execSuccess(value: unknown, message?: string | Error): asserts value is ExecSuccess;
|
|
605
|
+
declare function execSkip(value: unknown, message?: string | Error): asserts value is ExecSkip;
|
|
420
606
|
/**
|
|
421
607
|
* Base62 encoder/decoder for binary data.
|
|
422
608
|
*
|
|
@@ -733,111 +919,6 @@ declare function bigIntBytes(value: bigint): Uint8Array;
|
|
|
733
919
|
* @group Binary
|
|
734
920
|
*/
|
|
735
921
|
declare function bigIntFromBytes(bytes: Uint8Array): bigint;
|
|
736
|
-
type Arrayable<T> = T[] | T;
|
|
737
|
-
type Awaitable<T> = Promise<T> | T;
|
|
738
|
-
type ArgumentsType<T> = T extends ((...args: infer U) => any) ? U : never;
|
|
739
|
-
type FunctionArgs<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
|
|
740
|
-
type DeepPartial<T> = T extends Date ? T : T extends object ? { [P in keyof T]?: DeepPartial<T[P]> } : T;
|
|
741
|
-
type DeepReadonly<T> = T extends unknown[] ? Readonly<T> : T extends object ? Readonly<{ [P in keyof T]: DeepReadonly<T[P]> }> : Readonly<T>;
|
|
742
|
-
type AnyFunction = (...args: any[]) => any;
|
|
743
|
-
type Data = Record<string, unknown>;
|
|
744
|
-
type GenericObject = Record<string, any>;
|
|
745
|
-
interface SelectOptionItem<T = any> {
|
|
746
|
-
text: string;
|
|
747
|
-
value: T;
|
|
748
|
-
props?: any;
|
|
749
|
-
}
|
|
750
|
-
type SelectOptions<T = any> = SelectOptionItem<T>[];
|
|
751
|
-
type OverwriteWith<T1, T2> = IsAny<T2> extends true ? T1 : Omit<T1, keyof T2> & T2;
|
|
752
|
-
type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false;
|
|
753
|
-
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
754
|
-
/**
|
|
755
|
-
* @example
|
|
756
|
-
* LiteralUnion<'foo' | 'bar', string>
|
|
757
|
-
*
|
|
758
|
-
* @see {@link https://github.com/microsoft/TypeScript/issues/29729}
|
|
759
|
-
*/
|
|
760
|
-
type LiteralUnion<Union, Type> = Union | (Type & Nothing);
|
|
761
|
-
interface Nothing {}
|
|
762
|
-
type ValuesOfObject<T> = T[keyof T];
|
|
763
|
-
type Fn$1 = () => void;
|
|
764
|
-
type PromisifyFn<T extends AnyFunction> = (...args: ArgumentsType<T>) => Promise<ReturnType<T>>;
|
|
765
|
-
/**
|
|
766
|
-
* A time value, which can be a string (e.g., "HH:MM"),
|
|
767
|
-
* an object with `h` (hours) and `m` (minutes) properties, or a similar format
|
|
768
|
-
* that `createTimeObject` can parse.
|
|
769
|
-
*/
|
|
770
|
-
type TimeValue = TimeString | TimeObject;
|
|
771
|
-
/**
|
|
772
|
-
* Represent time string in 24h format
|
|
773
|
-
*/
|
|
774
|
-
type TimeString = string;
|
|
775
|
-
/**
|
|
776
|
-
* Represent time object in 24h format ("HH:MM")
|
|
777
|
-
*/
|
|
778
|
-
type TimeObject = {
|
|
779
|
-
/**
|
|
780
|
-
* Hour (0 - 23).
|
|
781
|
-
*/
|
|
782
|
-
h: number;
|
|
783
|
-
/**
|
|
784
|
-
* Minutes (0 - 59).
|
|
785
|
-
*/
|
|
786
|
-
m: number;
|
|
787
|
-
};
|
|
788
|
-
/**
|
|
789
|
-
* Represent date object
|
|
790
|
-
*/
|
|
791
|
-
type DateObject = {
|
|
792
|
-
/**
|
|
793
|
-
* The year of the date (e.g., 2024).
|
|
794
|
-
*/
|
|
795
|
-
year: number;
|
|
796
|
-
/**
|
|
797
|
-
* The month of the date (1 = January, 12 = December).
|
|
798
|
-
*/
|
|
799
|
-
month: number;
|
|
800
|
-
/**
|
|
801
|
-
* The day of the month (1-31).
|
|
802
|
-
*/
|
|
803
|
-
date: number;
|
|
804
|
-
};
|
|
805
|
-
interface ThemeConfig {
|
|
806
|
-
colors: {
|
|
807
|
-
[x: string]: Record<string, string>;
|
|
808
|
-
};
|
|
809
|
-
variables: {
|
|
810
|
-
[x: string]: Record<string, string | number>;
|
|
811
|
-
};
|
|
812
|
-
}
|
|
813
|
-
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
814
|
-
interface SelectOptionItem<T = any> {
|
|
815
|
-
text: string;
|
|
816
|
-
value: T;
|
|
817
|
-
props?: any;
|
|
818
|
-
}
|
|
819
|
-
type Primitive = null | undefined | string | number | bigint | boolean | symbol;
|
|
820
|
-
type ExecResult<T extends Data = Data, K extends Data = Data> = ExecSuccess<T> | ExecSkip<K>;
|
|
821
|
-
type ExecSuccess<T extends Data = Data> = {
|
|
822
|
-
success: true;
|
|
823
|
-
code: string;
|
|
824
|
-
reason?: string;
|
|
825
|
-
} & T;
|
|
826
|
-
type ExecSkip<T extends Data = Data> = {
|
|
827
|
-
skip: true;
|
|
828
|
-
code: string;
|
|
829
|
-
reason?: string;
|
|
830
|
-
} & T;
|
|
831
|
-
type ExecResultToSuccess<T> = T extends ExecSuccess<infer X> ? ExecSuccess<X> : ExecSuccess;
|
|
832
|
-
type ExecResultToSkip<T> = T extends ExecSkip<infer X> ? ExecSkip<X> : ExecSkip;
|
|
833
|
-
interface Logger {
|
|
834
|
-
info: (...args: unknown[]) => void;
|
|
835
|
-
warn: (...args: unknown[]) => void;
|
|
836
|
-
error: (...args: unknown[]) => void;
|
|
837
|
-
debug: (...args: unknown[]) => void;
|
|
838
|
-
log: (...args: unknown[]) => void;
|
|
839
|
-
extend: (...args: unknown[]) => Logger;
|
|
840
|
-
}
|
|
841
922
|
declare namespace BitPack {
|
|
842
923
|
type Field = {
|
|
843
924
|
name: string;
|
|
@@ -3007,11 +3088,15 @@ declare function debounce<F extends (...args: any[]) => void>(func: F, debounceM
|
|
|
3007
3088
|
/**
|
|
3008
3089
|
* @group Utility Functions
|
|
3009
3090
|
*/
|
|
3010
|
-
declare function isSuccess<T
|
|
3091
|
+
declare function isSuccess<T>(value: T): value is ExecResultToSuccess<T>;
|
|
3011
3092
|
/**
|
|
3012
3093
|
* @group Utility Functions
|
|
3013
3094
|
*/
|
|
3014
|
-
declare function isSkip<T
|
|
3095
|
+
declare function isSkip<T>(value: T): value is ExecResultToSkip<T>;
|
|
3096
|
+
/**
|
|
3097
|
+
* @group Utility Functions
|
|
3098
|
+
*/
|
|
3099
|
+
declare function stringifyExecResult(value: ExecResult): string;
|
|
3015
3100
|
/**
|
|
3016
3101
|
* Returns the input value unchanged.
|
|
3017
3102
|
*
|
|
@@ -5062,6 +5147,62 @@ declare function asyncFilter<T>(array: T[], predicate: (value: T, index: number,
|
|
|
5062
5147
|
}?: {
|
|
5063
5148
|
concurrency?: number | undefined;
|
|
5064
5149
|
}): Promise<T[]>;
|
|
5150
|
+
/**
|
|
5151
|
+
* Asynchronously filters and maps an array in a single pass, with bounded
|
|
5152
|
+
* concurrency.
|
|
5153
|
+
*
|
|
5154
|
+
* The callback may be async and receives a `skip` sentinel as its second
|
|
5155
|
+
* argument. Return any mapped value (or a promise of one) to keep it, or return
|
|
5156
|
+
* `skip` to exclude the current element. Combining the filter and map avoids the
|
|
5157
|
+
* extra allocation and second traversal of chaining `.filter().map()`.
|
|
5158
|
+
*
|
|
5159
|
+
* Up to `concurrency` callbacks run at a time. Even though callbacks may settle
|
|
5160
|
+
* out of order, the resolved array preserves **strict source order** and
|
|
5161
|
+
* contains no gaps for skipped elements. Work is spread across microtasks so a
|
|
5162
|
+
* large input does not block the event loop.
|
|
5163
|
+
*
|
|
5164
|
+
* If any callback rejects (or throws), the returned promise rejects with that
|
|
5165
|
+
* error and no further elements are processed.
|
|
5166
|
+
*
|
|
5167
|
+
* @param array - The source array to iterate over. It is not mutated.
|
|
5168
|
+
* @param callbackfn - Called for each element with `(value, skip, index, array)`.
|
|
5169
|
+
* Return the mapped value (or a promise of it) to keep, or `skip` to drop the
|
|
5170
|
+
* element.
|
|
5171
|
+
* @param options - Options object.
|
|
5172
|
+
* @param options.concurrency - Maximum number of callbacks in flight at once.
|
|
5173
|
+
* Defaults to `1` (sequential); values below `1` are clamped to `1`.
|
|
5174
|
+
* @returns A promise resolving to a new array of the mapped values, in source
|
|
5175
|
+
* order, excluding any skipped elements.
|
|
5176
|
+
*
|
|
5177
|
+
* @example
|
|
5178
|
+
* ```ts
|
|
5179
|
+
* // Keep even numbers and double them, dropping the rest.
|
|
5180
|
+
* await asyncFilterMap([1, 2, 3, 4], (value, skip) =>
|
|
5181
|
+
* value % 2 === 0 ? value * 2 : skip,
|
|
5182
|
+
* );
|
|
5183
|
+
* // => [4, 8]
|
|
5184
|
+
* ```
|
|
5185
|
+
*
|
|
5186
|
+
* @example
|
|
5187
|
+
* ```ts
|
|
5188
|
+
* // Fetch users concurrently, skipping the ones that don't exist.
|
|
5189
|
+
* const users = await asyncFilterMap(
|
|
5190
|
+
* ids,
|
|
5191
|
+
* async (id, skip) => {
|
|
5192
|
+
* const res = await fetch(`/users/${id}`);
|
|
5193
|
+
* return res.ok ? res.json() : skip;
|
|
5194
|
+
* },
|
|
5195
|
+
* { concurrency: 5 },
|
|
5196
|
+
* );
|
|
5197
|
+
* ```
|
|
5198
|
+
*
|
|
5199
|
+
* @group Promise
|
|
5200
|
+
*/
|
|
5201
|
+
declare function asyncFilterMap<T, U>(array: T[], callbackfn: (value: T, skip: SpecialValue, index: number, array: T[]) => Awaitable<U | SpecialValue>, {
|
|
5202
|
+
concurrency
|
|
5203
|
+
}?: {
|
|
5204
|
+
concurrency?: number | undefined;
|
|
5205
|
+
}): Promise<U[]>;
|
|
5065
5206
|
/**
|
|
5066
5207
|
* Asynchronously finds the first element in an array that satisfies the provided async predicate.
|
|
5067
5208
|
*
|
|
@@ -6486,5 +6627,5 @@ declare function wrapText(value: string, maxLength?: number): string;
|
|
|
6486
6627
|
* @group Errors
|
|
6487
6628
|
*/
|
|
6488
6629
|
declare function toError<T>(value: T, unknownMessage?: string): T extends Error ? T : Error;
|
|
6489
|
-
export { type AnyFunction, AppError, AppErrorOptions, type ArgumentsType, type Arrayable, AssertionError, AsyncIterableQueue, type Awaitable, Base64ToBytesOptions, BaseX, BitPack, BitUnpack, BytesToBase64Options, CancellablePromise, CatchErrorResult, type Color, ColorChannels, ColorParser, type Data, type DateObject, DateObjectInput, DebouncedFunction, type DeepPartial, type DeepReadonly, Defer, instance as EJSON, EJSON as EJSONInstance, EJSONStream, EJSONStreamOptions, EJSONStreamOptionsWithPayload, type EJSONType, EnvParser, type ExecResult, type ExecResultToSkip, type ExecResultToSuccess, type ExecSkip, type ExecSuccess, FindMean, FixedMap, FixedWeakMap, type Fn$1 as Fn, FormatMoney, FormatNumber, type FunctionArgs, type GenericObject, type IfAny, type IsAny, type LiteralUnion, LogLevel, type Logger, LruCache, type Nothing, type OverwriteWith, type Prettify, type Primitive, type PromisifyFn, Queue, RandomizerOptions, ResourcePool, ResourcePoolEventMap, ResourcePoolOptions, RetryOnErrorConfig, SCHEDULER_JOB_FLAGS, Scheduler, SecureCustomizerOptions, type SelectOptionItem, type SelectOptions, SimpleDefaultEventMap, SimpleEventEmitter, SimpleEventMap, SortedArray, SortedArrayCompareFn, _default as TWEMOJI_REGEX, type ThemeConfig, ThrottledFunction, TimeBucket, TimeBucketOptions, type TimeObject, TimeObjectInput, TimeSpan, type TimeSpanUnit, type TimeString, type TimeValue, TimestampMsInput, TypeOf, TypeOfMap, type ValuesOfObject, WithCache, WithCacheBucketBatchOptions, WithCacheBucketOptions, WithCacheFixedOptions, WithCacheLruOptions, WithCacheOptions, WithCachePointer, WithCacheResult, WithCacheStorage, WithCode, WithCustomizer, WithCustomizerFactory, WithCustomizerValue, WrrItem, alpha, argumentsTag, arrayBufferTag, arrayTag, arrayable, assert_d_exports as assert, asyncFilter, asyncFind, asyncForEach, asyncMap, avg, avgCircular, base62, base62Fast, base64, base64ToBytes, base64url, basex, bigInt64ArrayTag, bigIntBytes, bigIntFromBytes, bigUint64ArrayTag, bigintTag, bitPack, bitUnpack, blendColors, booleanTag, buildCssColor, bytesToBase64, cache, cacheBucket, cacheFixed, cacheLRU, camelCase, capitalize, captureStackTrace, catchError, channelsToHSL, channelsToHex, channelsToRGB, checkBitmask, chunk, chunkSeries, clamp, cleanEmpty, cleanObject, colorToChannels, compareBytes, concatenateBytes, constant, contrastRatio, convertToUnit, crc32, createCustomizer, createCustomizerFactory, createDateObject, createDeepCloneWith, createEJSON, createEJSONStream, createEnvParser, createFunction, createRandomizer, createScheduler, createSecureCustomizer, createTimeObject, createTimeSpan, createWithCache, cssVariable, dataViewTag, dateInDays, dateInSeconds, dateTag, debounce, deepAssign, deepClone, deepCloneWith, deepDefaults, deepFreeze, def, defer, delay, difference, dropCache, env, errorTag, escapeHtml, escapeNumeric, escapeRegExp, fastIdle, fastIdlePromise, fastRaf, findMean, flagsToMap, flatten, float32ArrayTag, float64ArrayTag, formatMoney, formatNumber, functionTag, get, getFileExtension, getFileName, getInitials, getLoggerLevel, getMostSpecificPaths, getRandomInt, getRandomTime, getTag, getWords, groupBy, has, hasOwn, hasProtocol, hex, hexToChannels, hmToSeconds, hslToChannels, humanFileSize, humanize, identity, int16ArrayTag, int32ArrayTag, int8ArrayTag, interpolateColor, intersection, intersectionBy, isBigInt, isBoolean, isBuffer, isCached, isClient, isColorChannels, isCustomizerFactory, isDate, isDateObject, isDeepKey, isDef, isEmpty, isEqual, isError, isFunction, isIndex, isInfinity, isMap, isNode, isNullOrUndefined, isNumber, isObject, isOneEmoji, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isSkip, isString, isSuccess, isSymbol, isTimeObject, isTimeString, isTimeValue, isTypedArray, isValidWeekDay, isWeakMap, isWeakSet, isWithCache, isoToFlagEmoji, kebabCase, keyBy, logger, lowerCase, luminance, mapTag, maskingEmail, maskingPhone, maskingWords, negate, nextTickIteration, noop, nullTag, numberTag, objectId, objectTag, omit, omitPrefixed, orderBy, parseAllNumbers, parseAlpha, parsePercentage, percentOf, pick, pickPrefixed, qs, rafPromise, randomString, regexpTag, removeVS16s, retryOnError, rgbToChannels, rleDecode, rleEncode, round2digits, secondsToHm, set, setLoggerLevel, setTag, shuffle, snakeCase, sprintf, startCase, strAssign, stringTag, sum, symbolTag, textDecoder, textEncoder, throttle, timeFromMinutes, timeStringify, timeToMinutes, timeout, timestamp, timestampMs, timestampToDate, tintedTextColor, toError, toKey, toMap, toPath, toPromise, toString, truncate, typeOf, uint16ArrayTag, uint16ToUint8, uint32ArrayTag, uint32ToUint8, uint8ArrayTag, uint8ClampedArrayTag, uint8ToUint16, uint8ToUint32, undefinedTag, unflatten, union, uniq, uniqBy, unset, updateWith, weakmapTag, weaksetTag, weeksInYear, weightedRoundRobin, withCache, withCacheBucket, withCacheBucketBatch, withCacheFixed, withCacheLRU, withDeepClone, withPointerCache, withResolve, wrapText };
|
|
6630
|
+
export { type AnyBrand, type AnyFunction, AppError, AppErrorOptions, type ArgumentsType, type Arrayable, AssertionError, AsyncIterableQueue, type Awaitable, Base64ToBytesOptions, BaseX, BitPack, BitUnpack, type Brand, type BrandTypeOf, BytesToBase64Options, CancellablePromise, CatchErrorResult, type Color, ColorChannels, ColorParser, type Data, type DateObject, DateObjectInput, DebouncedFunction, type DeepPartial, type DeepReadonly, Defer, instance as EJSON, EJSON as EJSONInstance, EJSONStream, EJSONStreamOptions, EJSONStreamOptionsWithPayload, type EJSONType, EnvParser, type ExecResult, type ExecResultToSkip, type ExecResultToSuccess, type ExecSkip, type ExecSuccess, FindMean, FixedMap, FixedWeakMap, type Fn$1 as Fn, FormatMoney, FormatNumber, type FunctionArgs, type GenericObject, type IfAny, type IsAny, type LiteralUnion, LogLevel, type Logger, LruCache, type Nothing, type OverwriteWith, type Prettify, type Primitive, type PromisifyFn, Queue, RandomizerOptions, ResourcePool, ResourcePoolEventMap, ResourcePoolOptions, RetryOnErrorConfig, SCHEDULER_JOB_FLAGS, Scheduler, SecureCustomizerOptions, type SelectOptionItem, type SelectOptions, SimpleDefaultEventMap, SimpleEventEmitter, SimpleEventMap, SortedArray, SortedArrayCompareFn, type SpecialValue, _default as TWEMOJI_REGEX, type ThemeConfig, ThrottledFunction, TimeBucket, TimeBucketOptions, type TimeObject, TimeObjectInput, TimeSpan, type TimeSpanUnit, type TimeString, type TimeValue, TimestampMsInput, TypeOf, TypeOfMap, type ValuesOfObject, WithCache, WithCacheBucketBatchOptions, WithCacheBucketOptions, WithCacheFixedOptions, WithCacheLruOptions, WithCacheOptions, WithCachePointer, WithCacheResult, WithCacheStorage, WithCode, WithCustomizer, WithCustomizerFactory, WithCustomizerValue, WrrItem, alpha, argumentsTag, arrayBufferTag, arrayTag, arrayable, assert_d_exports as assert, asyncFilter, asyncFilterMap, asyncFind, asyncForEach, asyncMap, avg, avgCircular, base62, base62Fast, base64, base64ToBytes, base64url, basex, bigInt64ArrayTag, bigIntBytes, bigIntFromBytes, bigUint64ArrayTag, bigintTag, bitPack, bitUnpack, blendColors, booleanTag, buildCssColor, bytesToBase64, cache, cacheBucket, cacheFixed, cacheLRU, camelCase, capitalize, captureStackTrace, catchError, channelsToHSL, channelsToHex, channelsToRGB, checkBitmask, chunk, chunkSeries, clamp, cleanEmpty, cleanObject, colorToChannels, compareBytes, concatenateBytes, constant, contrastRatio, convertToUnit, crc32, createCustomizer, createCustomizerFactory, createDateObject, createDeepCloneWith, createEJSON, createEJSONStream, createEnvParser, createFunction, createRandomizer, createScheduler, createSecureCustomizer, createTimeObject, createTimeSpan, createWithCache, cssVariable, dataViewTag, dateInDays, dateInSeconds, dateTag, debounce, deepAssign, deepClone, deepCloneWith, deepDefaults, deepFreeze, def, defer, delay, difference, dropCache, env, errorTag, escapeHtml, escapeNumeric, escapeRegExp, fastIdle, fastIdlePromise, fastRaf, filterMap, findMean, flagsToMap, flatten, float32ArrayTag, float64ArrayTag, formatMoney, formatNumber, functionTag, get, getFileExtension, getFileName, getInitials, getLoggerLevel, getMostSpecificPaths, getRandomInt, getRandomTime, getTag, getWords, groupBy, has, hasOwn, hasProtocol, hex, hexToChannels, hmToSeconds, hslToChannels, humanFileSize, humanize, identity, int16ArrayTag, int32ArrayTag, int8ArrayTag, interpolateColor, intersection, intersectionBy, isBigInt, isBoolean, isBuffer, isCached, isClient, isColorChannels, isCustomizerFactory, isDate, isDateObject, isDeepKey, isDef, isEmpty, isEqual, isError, isFunction, isIndex, isInfinity, isMap, isNode, isNullOrUndefined, isNumber, isObject, isOneEmoji, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isSkip, isString, isSuccess, isSymbol, isTimeObject, isTimeString, isTimeValue, isTypedArray, isValidWeekDay, isWeakMap, isWeakSet, isWithCache, isoToFlagEmoji, kebabCase, keyBy, logger, lowerCase, luminance, mapTag, maskingEmail, maskingPhone, maskingWords, negate, nextTickIteration, noop, nullTag, numberTag, objectId, objectTag, omit, omitPrefixed, orderBy, parseAllNumbers, parseAlpha, parsePercentage, percentOf, pick, pickPrefixed, qs, rafPromise, randomString, regexpTag, removeVS16s, retryOnError, rgbToChannels, rleDecode, rleEncode, round2digits, secondsToHm, set, setLoggerLevel, setTag, shuffle, snakeCase, sprintf, startCase, strAssign, stringTag, stringifyExecResult, sum, symbolTag, textDecoder, textEncoder, throttle, timeFromMinutes, timeStringify, timeToMinutes, timeout, timestamp, timestampMs, timestampToDate, tintedTextColor, toError, toKey, toMap, toPath, toPromise, toString, truncate, typeOf, uint16ArrayTag, uint16ToUint8, uint32ArrayTag, uint32ToUint8, uint8ArrayTag, uint8ClampedArrayTag, uint8ToUint16, uint8ToUint32, undefinedTag, unflatten, union, uniq, uniqBy, unset, updateWith, weakmapTag, weaksetTag, weeksInYear, weightedRoundRobin, withCache, withCacheBucket, withCacheBucketBatch, withCacheFixed, withCacheLRU, withDeepClone, withPointerCache, withResolve, wrapText };
|
|
6490
6631
|
//# sourceMappingURL=index.d.mts.map
|