📜  foreach 异步打字稿 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:12.032000             🧑  作者: Mango

代码示例3
export async function asyncForEach(array: Array, callback: (item: T, index: number) => void) {
        for (let index = 0; index < array.length; index++) {
            await callback(array[index], index);
        }
    }

await asyncForEach(receipts, async (eachItem) => {
    await ...
})