async.map which works on objects
See original GitHub issueI had a use case just now for async.map which iterates on the values of an object, and whose callback has a new object with the original keys pointing to the translated values of the same keys.
async.map as it exists doesn’t allow this, and I couldn’t see another method which does the same (please let me know if I missed it).
I think it’d be useful feature.
In the mean time, I faked it with underscore by doing async.map(_.values(obj), ...
and then in the callback using _.object(_.keys(obj), transformed)
.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Best way to call an asynchronous function within map?
To make filter, some and every work you can first use an async map (that in turn uses Promise.all) and then go through...
Read more >How to use async functions with Array.map in Javascript
The map is the easiest and most common collection function. It runs each element through an iteratee function and returns an array with...
Read more >How to use Async and Await with Array.prototype.map()
You want to execute an async function inside a map() call, to perform an operation on every element of the array, and get...
Read more >Async map with limited parallelism in Node.js - Alex Ewerlöf
Async map with limited parallelism in Node.js ... A Array.map() is a very useful function but, unfortunately, it only works with synchronous functions....
Read more >Use async / await with Javascript's .map() and other high- ...
The .map() algorithm applies an async callback to each element of an array, creating promises as it does. However, the returned result by...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Another Version of @glukki 's Wrapper:
Great – thanks.