/** * 对数据数组进行并发限制的遍历 * * 返回结果中的 result 与 datas 一一对应,如果某个数据的处理失败,对应的 result 为 undefined * 处理函数(handler)中的错误默认会被忽略,不会导致整个函数失败,错误会被记录到 errors 中, * 可以通过参数 throwWithErrors: true 来改变这个行为,遇到错误时会抛出异常 * * @example * let urls = ["http://1.com", "http://2.com", "http://3.com"] * let reuslt = await eachWithLimit(urls, async (url) => {}, options:{ limit: 10 }}) */ export declare function eachWithLimit(datas: TData[], handler: (data: TData, index: number) => Promise, options?: { /** 并发限制 */ limit?: number; /** 遇到错误时是否抛出异常,终止队列 */ throwWithErrors?: boolean; }): Promise<{ result: (TDataRe | undefined)[]; errors: { [index: string]: Error; }; }>; //# sourceMappingURL=eachWithLimit.d.ts.map