Implement a function mapAsyncLimit(items, fn, size) that maps over an array with an asynchronous function but limits the number of concurrently running async tasks.
The function should:
fn that returns a Promise.size. If not provided, all tasks can run concurrently.Example
async function fetchUpperCase(q) { return q.toUpperCase(); } const results = await mapAsyncLimit(['foo', 'bar', 'qux'], fetchUpperCase, 2); console.log(results); // ['FOO', 'BAR', 'QUX']
JavaScript Function
No test results yet
Click "Run" to execute tests