import asyncMap from './map.js'; export default function asyncForEach( arr: T[], fn: (cur: T, idx: number, arr: T[]) => Promise, ): Promise { return new Promise((resolve, reject) => { asyncMap(arr, fn) .then(() => resolve()) .catch(reject); }); }