Page MenuHomeSealhub

async-foreach.ts
No OneTemporary

async-foreach.ts

/* eslint-disable @typescript-eslint/no-explicit-any */
// warning - things might get executed out of order
export default async function asyncForEach<T = any>(
array: T[],
fn: (obj: T) => Promise<void>
): Promise<void> {
const promises: Promise<void>[] = [];
for (const element of array) {
promises.push(fn(element));
}
await Promise.all(promises);
}

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 13:27 (20 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
554754
Default Alt Text
async-foreach.ts (361 B)

Event Timeline