Implement mapLimit(items, n, asyncFn)
Firing off 500 requests with Promise.all will get you rate-limited (or worse). Write mapLimit(items, n, asyncFn), a bounded-concurrency pool: run asyncFn over every item, but never more than n calls in flight at once, and resolve with the results in the same order as the input (regardless of which finishes first).
await mapLimit([1, 2, 3, 4, 5], 2, async (n) => n * 2);
// [2, 4, 6, 8, 10], computed with at most 2 concurrent calls to asyncFn