1
0
mirror of https://github.com/sasjs/lint.git synced 2025-12-11 01:44:36 +00:00
Files
lint/src/utils/asyncForEach.ts
2021-04-07 10:57:55 +01:00

12 lines
304 B
TypeScript

/**
* Executes an async callback for each item in the given array.
*/
export async function asyncForEach(
array: any[],
callback: (item: any, index: number, originalArray: any[]) => any
) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}