DEV Community

Discussion on: Concurrent Iteration

Collapse
 
ycmjason profile image
YCM Jason

I think what would be really nice to have is, instead of Promsie.map, Array.prototype.amap/Array.prototype.afilter and Array.prototype.areduce. They all return a promise. This would be really handy.

studentDetails
  .amap(getPerformanceRecordOfStudent)
  .then(doSomethingWithPerformanceRecordsOfAllStudents)

This is essentially the same thing, but I think it is more intuitive to use.

What do you think about this idea?

Collapse
 
hoodwink73 profile image
Arijit Bhattacharya

That would be interesting.

But adding something to native JS API, thats a lot to hope for :)

There are lots of other Promise utilities which will offer us handy utilities like this out of the box.

Collapse
 
hoodwink73 profile image
Arijit Bhattacharya • Edited

BTW, based on your comment, you would be super interested in the new async iteration proposal

Kushan also gives a small example in his comment.