const maxParallelRequests = 1;
const limit = pLimit(maxParallelRequests);
// Use the map method to create an array of promises for each call to GetData
const promises = items.map(item => {
limit(() => this.getData(item))
});
When I log promises I get an array of 60 undefined items.
When I log
promises
I get an array of 60undefined
items.What am I doing wrong here?
item
is defined inside the map function.