Skip to content

Home > sculp-js > asyncMap

asyncMap() function

异步遍历 https://github.com/Kevnz/async-tools/blob/master/src/mapper.js https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global\_Objects/Array/@@iterator

Signature:

typescript
export declare function asyncMap<T, R>(list: Array<T>, mapper: (val: T, idx: number, list: Array<T>) => Promise<R>, concurrency?: number): Promise<R[]>;

Parameters

Parameter

Type

Description

list

Array<T>

mapper

(val: T, idx: number, list: Array<T>) => Promise<R>

concurrency

number

(Optional) 并发数量,默认无限

Returns:

Promise<R[]>

{Promise<R[]>}

Released under the MIT License.