@types/async
- Version 3.2.24
- Published
- 30.6 kB
- No dependencies
- MIT license
Install
npm i @types/async
yarn add @types/async
pnpm add @types/async
Overview
TypeScript definitions for async
Index
Variables
- all
- allLimit
- allSeries
- any
- anyLimit
- anySeries
- concatSeries
- detectSeries
- eachOf
- eachOfLimit
- eachOfSeries
- eachSeries
- everySeries
- filterSeries
- find
- findLimit
- findSeries
- flatMap
- flatMapLimit
- flatMapSeries
- foldl
- foldr
- forEach
- forEachLimit
- forEachOfSeries
- forEachSeries
- groupBySeries
- inject
- mapSeries
- mapValuesSeries
- reduceRight
- reject
- rejectLimit
- rejectSeries
- select
- selectLimit
- selectSeries
- setImmediate
- someSeries
- timesSeries
Functions
- apply()
- applyEach()
- applyEachSeries()
- asyncify()
- auto()
- autoInject()
- cargo()
- cargoQueue()
- compose()
- concat()
- concatLimit()
- constant()
- detect()
- detectLimit()
- dir()
- doDuring()
- doUntil()
- doWhilst()
- during()
- each()
- eachLimit()
- ensureAsync()
- every()
- everyLimit()
- filter()
- filterLimit()
- forEachOf()
- forEachOfLimit()
- forever()
- groupBy()
- groupByLimit()
- log()
- map()
- mapLimit()
- mapValues()
- mapValuesLimit()
- memoize()
- nextTick()
- parallel()
- parallelLimit()
- priorityQueue()
- queue()
- race()
- reduce()
- reflect()
- reflectAll()
- retry()
- retryable()
- seq()
- series()
- some()
- someLimit()
- sortBy()
- timeout()
- times()
- timesLimit()
- transform()
- tryEach()
- unmemoize()
- until()
- waterfall()
- whilst()
- wrapSync()
Interfaces
Type Aliases
Variables
variable all
const all: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncBooleanResultCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<boolean>;};
variable allLimit
const allLimit: { <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback: AsyncBooleanResultCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E> ): Promise<boolean>;};
variable allSeries
const allSeries: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncBooleanResultCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<boolean>;};
variable any
const any: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncBooleanResultCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<boolean>;};
variable anyLimit
const anyLimit: <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>) => void;
variable anySeries
const anySeries: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncBooleanResultCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<boolean>;};
variable concatSeries
const concatSeries: { <T, R, E = Error>( arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E>, callback: AsyncResultArrayCallback<R, E> ): void; <T, R, E = Error>( arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E> ): Promise<R[]>;};
variable detectSeries
const detectSeries: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<T>;};
variable eachOf
const eachOf: { <T, E = Error>( obj: IterableCollection<T>, iterator: AsyncForEachOfIterator<T, E>, callback: ErrorCallback<E> ): void; <T, E = Error>( obj: IterableCollection<T>, iterator: AsyncForEachOfIterator<T, E> ): Promise<void>;};
variable eachOfLimit
const eachOfLimit: { <T, E = Error>( obj: IterableCollection<T>, limit: number, iterator: AsyncForEachOfIterator<T, E>, callback: ErrorCallback<E> ): void; <T, E = Error>( obj: IterableCollection<T>, limit: number, iterator: AsyncForEachOfIterator<T, E> ): Promise<void>;};
variable eachOfSeries
const eachOfSeries: { <T, E = Error>( obj: IterableCollection<T>, iterator: AsyncForEachOfIterator<T, E>, callback: ErrorCallback<E> ): void; <T, E = Error>( obj: IterableCollection<T>, iterator: AsyncForEachOfIterator<T, E> ): Promise<void>;};
variable eachSeries
const eachSeries: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncIterator<T, E>, callback: ErrorCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncIterator<T, E> ): Promise<void>;};
variable everySeries
const everySeries: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncBooleanResultCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<boolean>;};
variable filterSeries
const filterSeries: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<T[]>;};
variable find
const find: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<T>;};
variable findLimit
const findLimit: { <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E> ): Promise<T>;};
variable findSeries
const findSeries: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<T>;};
variable flatMap
const flatMap: { <T, R, E = Error>( arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E>, callback: AsyncResultArrayCallback<R, E> ): void; <T, R, E = Error>( arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E> ): Promise<R[]>;};
variable flatMapLimit
const flatMapLimit: { <T, R, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R[], E>, callback: AsyncResultArrayCallback<R, E> ): void; <T, R, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R[], E> ): Promise<R[]>;};
variable flatMapSeries
const flatMapSeries: { <T, R, E = Error>( arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E>, callback: AsyncResultArrayCallback<R, E> ): void; <T, R, E = Error>( arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E> ): Promise<R[]>;};
variable foldl
const foldl: { <T, R, E = Error>( arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E>, callback: AsyncResultCallback<R, E> ): void; <T, R, E = Error>( arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E> ): Promise<R>;};
variable foldr
const foldr: { <T, R, E = Error>( arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E>, callback: AsyncResultCallback<R, E> ): void; <T, R, E = Error>( arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E> ): Promise<R>;};
variable forEach
const forEach: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncIterator<T, E>, callback: ErrorCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncIterator<T, E> ): Promise<void>;};
variable forEachLimit
const forEachLimit: { <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncIterator<T, E>, callback: ErrorCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncIterator<T, E> ): Promise<void>;};
variable forEachOfSeries
const forEachOfSeries: { <T, E = Error>( obj: IterableCollection<T>, iterator: AsyncForEachOfIterator<T, E>, callback: ErrorCallback<E> ): void; <T, E = Error>( obj: IterableCollection<T>, iterator: AsyncForEachOfIterator<T, E> ): Promise<void>;};
variable forEachSeries
const forEachSeries: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncIterator<T, E>, callback: ErrorCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncIterator<T, E> ): Promise<void>;};
variable groupBySeries
const groupBySeries: { <T, K, E = Error>( iterable: IterableCollection<T>, iterator: AsyncResultIterator<T, K, E>, callback: AsyncResultCallback<Record<string, T[]>, E> ): void; <T, K, E = Error>( iterable: IterableCollection<T>, iterator: AsyncResultIterator<T, K, E> ): Promise<Record<string, T[]>>;};
variable inject
const inject: { <T, R, E = Error>( arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E>, callback: AsyncResultCallback<R, E> ): void; <T, R, E = Error>( arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E> ): Promise<R>;};
variable mapSeries
const mapSeries: { <T, R, E = Error>( arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>, callback: AsyncResultArrayCallback<R, E> ): void; <T, R, E = Error>( arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R> ): Promise<R[]>;};
variable mapValuesSeries
const mapValuesSeries: { <T, R, E = Error>( obj: Dictionary<T>, iteratee: ( value: T, key: string, callback: AsyncResultCallback<R, E> ) => void, callback: AsyncResultObjectCallback<R, E> ): void; <T, R, E = Error, C = unknown>( obj: Dictionary<T>, iteratee: ( value: T, key: string, callback: C extends undefined ? never : AsyncResultCallback<R, E> ) => C extends undefined ? Promise<R> : void ): Promise<Dictionary<R>>;};
variable reduceRight
const reduceRight: { <T, R, E = Error>( arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E>, callback: AsyncResultCallback<R, E> ): void; <T, R, E = Error>( arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E> ): Promise<R>;};
variable reject
const reject: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<T[]>;};
variable rejectLimit
const rejectLimit: { <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E> ): Promise<T[]>;};
variable rejectSeries
const rejectSeries: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<T[]>;};
variable select
const select: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<T[]>;};
variable selectLimit
const selectLimit: { <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E> ): Promise<T[]>;};
variable selectSeries
const selectSeries: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<T[]>;};
variable setImmediate
const setImmediate: (callback: Function, ...args: any[]) => void;
variable someSeries
const someSeries: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncBooleanResultCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<boolean>;};
variable timesSeries
const timesSeries: { <T, E = Error>( n: number, iterator: | AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T>, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( n: number, iterator: | AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T> ): Promise<T>;};
Functions
function apply
apply: <E = Error>(fn: Function, ...args: any[]) => AsyncFunction<any, E>;
function applyEach
applyEach: (fns: Function[], ...argsAndCallback: any[]) => void;
function applyEachSeries
applyEachSeries: (fns: Function[], ...argsAndCallback: any[]) => void;
function asyncify
asyncify: (fn: Function) => (...args: any[]) => any;
function auto
auto: { <R extends Dictionary<any>, E = Error>( tasks: AsyncAutoTasks<R, E>, concurrency?: number ): Promise<R>; <R extends Dictionary<any>, E = Error>( tasks: AsyncAutoTasks<R, E>, concurrency: number, callback: AsyncResultCallback<R, E> ): void; <R extends Dictionary<any>, E = Error>( tasks: AsyncAutoTasks<R, E>, callback: AsyncResultCallback<R, E> ): void;};
function autoInject
autoInject: <E = Error>( tasks: any, callback?: AsyncResultCallback<any, E>) => void;
function cargo
cargo: <T, E = Error>( worker: AsyncWorker<T[], E>, payload?: number) => QueueObject<T>;
function cargoQueue
cargoQueue: <T, E = Error>( worker: AsyncWorker<T[], E>, concurrency?: number, payload?: number) => QueueObject<T>;
function compose
compose: (...fns: Function[]) => Function;
function concat
concat: { <T, R, E = Error>( arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E>, callback: AsyncResultArrayCallback<R, E> ): void; <T, R, E = Error>( arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E> ): Promise<R[]>;};
function concatLimit
concatLimit: { <T, R, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R[], E>, callback: AsyncResultArrayCallback<R, E> ): void; <T, R, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R[], E> ): Promise<R[]>;};
function constant
constant: (...values: any[]) => AsyncFunction<any>;
function detect
detect: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<T>;};
function detectLimit
detectLimit: { <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E> ): Promise<T>;};
function dir
dir: (fn: Function, ...args: any[]) => void;
function doDuring
doDuring: <E = Error>( fn: AsyncVoidFunction<E>, test: (testCallback: AsyncBooleanResultCallback<E>) => void, callback: ErrorCallback<E>) => void;
function doUntil
doUntil: { <T, E = Error>( fn: AsyncFunctionEx<T, E>, test: (cb: AsyncBooleanResultCallback) => void, callback: AsyncResultRestCallback<T, E> ): void; <T, R, E = Error>( fn: AsyncFunctionEx<T, E>, test: (cb: AsyncBooleanResultCallback<Error>) => void ): Promise<R>;};
function doWhilst
doWhilst: { <T, E = Error>( fn: AsyncFunctionEx<T, E>, test: (cb: AsyncBooleanResultCallback) => void, callback: AsyncResultRestCallback<T, E> ): void; <T, R, E = Error>( fn: AsyncFunctionEx<T, E>, test: (cb: AsyncBooleanResultCallback<Error>) => void ): Promise<R>;};
function during
during: <E = Error>( test: (testCallback: AsyncBooleanResultCallback<E>) => void, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>) => void;
function each
each: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncIterator<T, E>, callback: ErrorCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncIterator<T, E> ): Promise<void>;};
function eachLimit
eachLimit: { <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncIterator<T, E>, callback: ErrorCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncIterator<T, E> ): Promise<void>;};
function ensureAsync
ensureAsync: (fn: (...argsAndCallback: any[]) => void) => Function;
function every
every: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncBooleanResultCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<boolean>;};
function everyLimit
everyLimit: { <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback: AsyncBooleanResultCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E> ): Promise<boolean>;};
function filter
filter: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<T[]>;};
function filterLimit
filterLimit: { <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E> ): Promise<T[]>;};
function forEachOf
forEachOf: { <T, E = Error>( obj: IterableCollection<T>, iterator: AsyncForEachOfIterator<T, E>, callback: ErrorCallback<E> ): void; <T, E = Error>( obj: IterableCollection<T>, iterator: AsyncForEachOfIterator<T, E> ): Promise<void>;};
function forEachOfLimit
forEachOfLimit: { <T, E = Error>( obj: IterableCollection<T>, limit: number, iterator: AsyncForEachOfIterator<T, E>, callback: ErrorCallback<E> ): void; <T, E = Error>( obj: IterableCollection<T>, limit: number, iterator: AsyncForEachOfIterator<T, E> ): Promise<void>;};
function forever
forever: <E = Error>( next: (next: ErrorCallback<E>) => void, errBack: ErrorCallback<E>) => void;
function groupBy
groupBy: { <T, K, E = Error>( iterable: IterableCollection<T>, iterator: AsyncResultIterator<T, K, E>, callback: AsyncResultCallback<Record<string, T[]>, E> ): void; <T, K, E = Error>( iterable: IterableCollection<T>, iterator: AsyncResultIterator<T, K, E> ): Promise<Record<string, T[]>>;};
function groupByLimit
groupByLimit: { <T, K, E = Error>( iterable: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, K, E>, callback: AsyncResultCallback<Record<string, T[]>, E> ): void; <T, K, E = Error>( iterable: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, K, E> ): Promise<Record<string, T[]>>;};
function log
log: (fn: Function, ...args: any[]) => void;
function map
map: { <T, R, E = Error>( arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>, callback: AsyncResultArrayCallback<R, E> ): void; <T, R, E = Error>( arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R> ): Promise<R[]>;};
function mapLimit
mapLimit: { <T, R, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>, callback: AsyncResultArrayCallback<R, E> ): void; <T, R, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R> ): Promise<R[]>;};
function mapValues
mapValues: { <T, R, E = Error>( obj: Dictionary<T>, iteratee: ( value: T, key: string, callback: AsyncResultCallback<R, E> ) => void, callback: AsyncResultObjectCallback<R, E> ): void; <T, R, E = Error, C = unknown>( obj: Dictionary<T>, iteratee: ( value: T, key: string, callback: C extends undefined ? never : AsyncResultCallback<R, E> ) => C extends undefined ? Promise<R> : void ): Promise<Dictionary<R>>;};
function mapValuesLimit
mapValuesLimit: { <T, R, E = Error>( obj: Dictionary<T>, limit: number, iteratee: ( value: T, key: string, callback: AsyncResultCallback<R, E> ) => void, callback: AsyncResultObjectCallback<R, E> ): void; <T, R, E = Error>( obj: Dictionary<T>, limit: number, iteratee: ( value: T, key: string, callback: AsyncResultCallback<R, E> ) => void ): Promise<R>;};
function memoize
memoize: (fn: Function, hasher?: Function) => Function;
function nextTick
nextTick: (callback: Function, ...args: any[]) => void;
function parallel
parallel: { <T, E = Error>( tasks: Array<AsyncFunction<T, E>>, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( tasks: Dictionary<AsyncFunction<T, E>>, callback: AsyncResultObjectCallback<T, E> ): void; <T, R, E = Error>( tasks: AsyncFunction<T, E>[] | Dictionary<AsyncFunction<T, E>> ): Promise<R>;};
function parallelLimit
parallelLimit: { <T, E = Error>( tasks: Array<AsyncFunction<T, E>>, limit: number, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( tasks: Dictionary<AsyncFunction<T, E>>, limit: number, callback: AsyncResultObjectCallback<T, E> ): void; <T, R, E = Error>( tasks: AsyncFunction<T, E>[] | Dictionary<AsyncFunction<T, E>>, limit: number ): Promise<R>;};
function priorityQueue
priorityQueue: <T, E = Error>( worker: AsyncWorker<T, E>, concurrency?: number) => AsyncPriorityQueue<T>;
function queue
queue: { <T, E = Error>(worker: AsyncWorker<T, E>, concurrency?: number): QueueObject<T>; <T, R, E = Error>( worker: AsyncResultIterator<T, R, E>, concurrency?: number ): QueueObject<T>;};
function race
race: <T, E = Error>( tasks: Array<AsyncFunction<T, E>>, callback: AsyncResultCallback<T, E>) => void;
function reduce
reduce: { <T, R, E = Error>( arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E>, callback: AsyncResultCallback<R, E> ): void; <T, R, E = Error>( arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E> ): Promise<R>;};
function reflect
reflect: <T, E = Error>( fn: AsyncFunction<T, E>) => ( callback: ( err: null, result: { error?: E | undefined; value?: T | undefined } ) => void) => void;
function reflectAll
reflectAll: <T, E = Error>( tasks: Array<AsyncFunction<T, E>>) => (( callback: ( err: null, result: { error?: E | undefined; value?: T | undefined } ) => void) => void)[];
function retry
retry: { <T, E = Error>( task: (() => Promise<T>) | ((callback: AsyncResultCallback<T, E>) => void) ): Promise<T>; <T, E = Error>( opts: number | RetryOptions<E>, task: (() => Promise<T>) | ((callback: AsyncResultCallback<T, E>) => void) ): Promise<T>; <T, E = Error>( task: (() => Promise<T>) | ((callback: AsyncResultCallback<T, E>) => void), callback: AsyncResultCallback<T, E> ): void; <T, E = Error>( opts: number | RetryOptions<E>, task: (() => Promise<T>) | ((callback: AsyncResultCallback<T, E>) => void), callback: AsyncResultCallback<T, E> ): void;};
function retryable
retryable: { <T, E = Error>(task: AsyncFunction<T, E>): AsyncFunction<T, E>; <T, E = Error>( opts: number | (RetryOptions<E> & { arity?: number }), task: AsyncFunction<T, E> ): AsyncFunction<T, E>;};
function seq
seq: (...fns: Function[]) => Function;
function series
series: { <T, E = Error>( tasks: Array<AsyncFunction<T, E>>, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( tasks: Dictionary<AsyncFunction<T, E>>, callback: AsyncResultObjectCallback<T, E> ): void; <T, E = Error>(tasks: AsyncFunction<T, E>[]): Promise<T[]>; <T, E = Error>(tasks: Dictionary<AsyncFunction<T, E>>): Promise<Dictionary<T>>;};
function some
some: { <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncBooleanResultCallback<E> ): void; <T, E = Error>( arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E> ): Promise<boolean>;};
function someLimit
someLimit: <T, E = Error>( arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>) => void;
function sortBy
sortBy: { <T, V, E = Error>( arr: T[] | IterableIterator<T>, iterator: AsyncResultIterator<T, V, E>, callback: AsyncResultArrayCallback<T, E> ): void; <T, V, E = Error>( arr: T[] | IterableIterator<T>, iterator: AsyncResultIterator<T, V, E> ): Promise<T[]>;};
function timeout
timeout: { <T, E = Error>( fn: AsyncFunction<T, E>, milliseconds: number, info?: any ): AsyncFunction<T, E>; <T, R, E = Error>( fn: AsyncResultIterator<T, R, E>, milliseconds: number, info?: any ): AsyncResultIterator<T, R, E>;};
function times
times: { <T, E = Error>( n: number, iterator: | AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T>, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( n: number, iterator: | AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T> ): Promise<T>;};
function timesLimit
timesLimit: { <T, E = Error>( n: number, limit: number, iterator: | AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T>, callback: AsyncResultArrayCallback<T, E> ): void; <T, E = Error>( n: number, limit: number, iterator: | AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T> ): Promise<T>;};
function transform
transform: { <T, R, E = Error>( arr: T[], iteratee: ( acc: R[], item: T, key: number, callback: (error?: E) => void ) => void, callback?: AsyncResultArrayCallback<T, E> ): void; <T, R, E = Error>( arr: T[], acc: R[], iteratee: ( acc: R[], item: T, key: number, callback: (error?: E) => void ) => void, callback?: AsyncResultArrayCallback<T, E> ): void; <T, R, E = Error>( arr: { [key: string]: T }, iteratee: ( acc: { [key: string]: R }, item: T, key: string, callback: (error?: E) => void ) => void, callback?: AsyncResultObjectCallback<T, E> ): void; <T, R, E = Error>( arr: { [key: string]: T }, acc: { [key: string]: R }, iteratee: ( acc: { [key: string]: R }, item: T, key: string, callback: (error?: E) => void ) => void, callback?: AsyncResultObjectCallback<T, E> ): void;};
function tryEach
tryEach: { <T, E = Error>( tasks: IterableCollection<AsyncFunction<T>>, callback: AsyncResultCallback<T, E> ): void; <T>(tasks: IterableCollection<AsyncFunction<T, Error>>): Promise<T>;};
function unmemoize
unmemoize: (fn: Function) => Function;
function until
until: { <T, E = Error>( test: (cb: AsyncBooleanResultCallback) => void, fn: AsyncFunctionEx<T, E>, callback: AsyncResultRestCallback<T, E> ): void; <T, R, E = Error>( test: (cb: AsyncBooleanResultCallback<Error>) => void, fn: AsyncFunctionEx<T, E> ): Promise<R>;};
function waterfall
waterfall: { <T>(tasks: Function[]): Promise<T>; <T, E = Error>(tasks: Function[], callback: AsyncResultCallback<T, E>): void;};
function whilst
whilst: { <T, E = Error>( test: (cb: AsyncBooleanResultCallback) => void, fn: AsyncFunctionEx<T, E>, callback: AsyncResultRestCallback<T, E> ): void; <T, R, E = Error>( test: (cb: AsyncBooleanResultCallback<Error>) => void, fn: AsyncFunctionEx<T, E> ): Promise<R>;};
function wrapSync
wrapSync: (fn: Function) => Function;
Interfaces
interface AsyncAutoTaskFunction
interface AsyncAutoTaskFunction<R1, R extends Dictionary<any>, E = Error> {}
call signature
(results: R, cb: AsyncResultCallback<R1, E> | ErrorCallback<E>): void;
interface AsyncAutoTaskFunctionWithoutDependencies
interface AsyncAutoTaskFunctionWithoutDependencies<R1, E = Error> {}
call signature
(cb: AsyncResultCallback<R1, E> | ErrorCallback<E>): void;
interface AsyncBooleanIterator
interface AsyncBooleanIterator<T, E = Error> {}
call signature
(item: T, callback: AsyncBooleanResultCallback<E>): void;
interface AsyncBooleanResultCallback
interface AsyncBooleanResultCallback<E = Error> {}
call signature
(err?: E | null, truthValue?: boolean): void;
interface AsyncForEachOfIterator
interface AsyncForEachOfIterator<T, E = Error> {}
call signature
(item: T, key: number | string, callback: ErrorCallback<E>): void;
interface AsyncFunction
interface AsyncFunction<T, E = Error> {}
call signature
(callback: (err?: E | null, result?: T) => void): void;
interface AsyncFunctionEx
interface AsyncFunctionEx<T, E = Error> {}
call signature
(callback: (err?: E | null, ...results: T[]) => void): void;
interface AsyncIterator
interface AsyncIterator<T, E = Error> {}
call signature
(item: T, callback: ErrorCallback<E>): void;
interface AsyncMemoIterator
interface AsyncMemoIterator<T, R, E = Error> {}
call signature
(memo: R | undefined, item: T, callback: AsyncResultCallback<R, E>): void;
interface AsyncPriorityQueue
interface AsyncPriorityQueue<T> extends Pick< QueueObject<T>, Exclude<keyof QueueObject<T>, 'push' | 'unshift'> > {}
A priorityQueue object to manage the tasks.
There are two differences between queue and priorityQueue objects: -
push(task, priority, [callback])
— priority should be a number. If an array of tasks is given, all tasks will be assigned the same priority. - Theunshift
method was removed.
method push
push: { <R>(task: T | T[], priority?: number): Promise<R>; <R, E = Error>( task: T | T[], priority: number, callback: AsyncResultCallback<R, E> ): void;};
interface AsyncResultArrayCallback
interface AsyncResultArrayCallback<T, E = Error> {}
call signature
(err?: E | null, results?: Array<T | undefined>): void;
interface AsyncResultCallback
interface AsyncResultCallback<T, E = Error> {}
call signature
(err?: E | null, result?: T): void;
interface AsyncResultIterator
interface AsyncResultIterator<T, R, E = Error> {}
call signature
(item: T, callback: AsyncResultCallback<R, E>): void;
interface AsyncResultIteratorPromise
interface AsyncResultIteratorPromise<T, R> {}
call signature
(item: T): Promise<R>;
interface AsyncResultObjectCallback
interface AsyncResultObjectCallback<T, E = Error> {}
call signature
(err: E | undefined, results: Dictionary<T | undefined>): void;
interface AsyncResultRestCallback
interface AsyncResultRestCallback<T, E = Error> {}
call signature
(err?: E | null, ...results: T[]): void;
interface AsyncVoidFunction
interface AsyncVoidFunction<E = Error> {}
call signature
(callback: ErrorCallback<E>): void;
interface AsyncWorker
interface AsyncWorker<T, E = Error> {}
call signature
(task: T, callback: ErrorCallback<E>): void;
interface CallbackContainer
interface CallbackContainer {}
property callback
callback: Function;
interface DataContainer
interface DataContainer<T> {}
interface Dictionary
interface Dictionary<T> {}
index signature
[key: string]: T;
interface ErrorCallback
interface ErrorCallback<E = Error> {}
call signature
(err?: E | null): void;
interface PriorityContainer
interface PriorityContainer {}
property priority
priority: number;
interface QueueObject
interface QueueObject<T> {}
property buffer
buffer: number;
A minimum threshold buffer in order to say that the
queue
isunsaturated
.
property concurrency
concurrency: number;
An integer for determining how many worker functions should be run in parallel. This property can be changed after a queue is created to alter the concurrency on-the-fly.
property paused
paused: boolean;
A boolean for determining whether the queue is in a paused state.
property payload
payload: number;
An integer that specifies how many items are passed to the worker function at a time. Only applies if this is a cargo object
property started
started: boolean;
Indicates whether or not any items have been pushed and processed by the queue.
method drain
drain: { (): Promise<void>; (handler: () => void): void };
A function that sets a callback that is called when the last item from the
queue
has returned from theworker
.If the callback is omitted,
q.drain()
returns a promise for the next occurrence.
method empty
empty: { (): Promise<void>; (handler: () => void): void };
A function that sets a callback that is called when the last item from the
queue
is given to aworker
.If the callback is omitted,
q.empty()
returns a promise for the next occurrence.
method error
error: { (): Promise<never>; (handler: (error: Error, task: T) => void): void };
A function that sets a callback that is called when a task errors.
If the callback is omitted,
q.error()
returns a promise that rejects on the next error.
method idle
idle: () => boolean;
Returns false if there are items waiting or being processed, or true if not.
method kill
kill: () => void;
A function that removes the drain callback and empties remaining tasks from the queue forcing it to go idle. No more tasks should be pushed to the queue after calling this function.
method length
length: () => number;
Returns the number of items waiting to be processed.
method pause
pause: () => void;
A function that pauses the processing of tasks until
q.resume()
is called.
method push
push: { <R>(task: T | T[]): Promise<R>; <R, E = Error>(task: T | T[], callback: AsyncResultCallback<R, E>): void;};
Add a new task to the queue. Calls
callback
once the worker has finished processing the task.Instead of a single task, a tasks array can be submitted. The respective callback is used for every task in the list.
method pushAsync
pushAsync: <R>(task: T | T[]) => Promise<R>;
The same as
q.push
, except this returns a promise that rejects if an error occurs. Thecallback
arg is ignored
method remove
remove: (filter: (node: DataContainer<T>) => boolean) => void;
Remove items from the queue that match a test function. The test function will be passed an object with a
data
property, and apriority
property, if this is apriorityQueue
object.
method resume
resume: () => void;
A function that resumes the processing of queued tasks when the queue is paused.
method running
running: () => number;
Returns the number of items currently being processed.
method saturated
saturated: { (): Promise<void>; (handler: () => void): void };
A function that sets a callback that is called when the number of running workers hits the
concurrency
limit, and further tasks will be queued.If the callback is omitted,
q.saturated()
returns a promise for the next occurrence.
method unsaturated
unsaturated: { (): Promise<void>; (handler: () => void): void };
A function that sets a callback that is called when the number of running workers is less than the
concurrency
&buffer
limits, and further tasks will not be queuedIf the callback is omitted,
q.unsaturated()
returns a promise for the next occurrence.
method unshift
unshift: { <R>(task: T | T[]): Promise<R>; <R, E = Error>(task: T | T[], callback: AsyncResultCallback<R, E>): void;};
Add a new task to the front of the queue
method unshiftAsync
unshiftAsync: <R>(task: T | T[]) => Promise<R>;
The same as
q.unshift
, except this returns a promise that rejects if an error occurs. Thecallback
arg is ignored
method workersList
workersList: < TWorker extends DataContainer<T>, CallbackContainer>() => TWorker[];
Returns an array of items currently being processed.
interface RetryOptions
interface RetryOptions<E> {}
property errorFilter
errorFilter?: ((error: E) => boolean) | undefined;
property interval
interval?: number | ((retryCount: number) => number) | undefined;
property times
times?: number | undefined;
Type Aliases
type AsyncAutoTask
type AsyncAutoTask<R1, R extends Dictionary<any>, E> = | AsyncAutoTaskFunctionWithoutDependencies<R1, E> | Array<keyof R | AsyncAutoTaskFunction<R1, R, E>>;
type AsyncAutoTasks
type AsyncAutoTasks<R extends Dictionary<any>, E> = { [K in keyof R]: AsyncAutoTask<R[K], R, E>;};
type AsyncCargoQueue
type AsyncCargoQueue<T = any> = QueueObject<T>;
Deprecated
this is a type that left here for backward compatibility. Please use QueueObject instead
type AsyncQueue
type AsyncQueue<T> = QueueObject<T>;
Deprecated
this is a type that left here for backward compatibility. Please use QueueObject instead
type IterableCollection
type IterableCollection<T> = | T[] | IterableIterator<T> | AsyncIterable<T> | Dictionary<T>;
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/async
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/async)
- HTML<a href="https://www.jsdocs.io/package/@types/async"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 6643 ms. - Missing or incorrect documentation? Open an issue for this package.