Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript foreach async await

export async function asyncForEach<T>(array: Array<T>, 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 ...
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #typescript #foreach #async #await
ADD COMMENT
Topic
Name
1+2 =