FuturesJS/ArrayAsync - The diet cola of asynchronous array utilities.
v3.x - Diet Cola Edition
ArrayAsync provides asynchronous counterparts for each of the Array iterate methods
reduceRightAsync* (uses reversed copy of original array)
Each of the other array methods is a thin (12-line long) wrapper around the
diet (27-line long)
which is the core workhorse.
Where size is a concern and you don't need all 86 lines of code, I would invite you to simply look at the source and copy/paste what you need (and attribute, of course).
bower install ArrayAsync
'use strict';var filterAsync = windowfilterAsync;filterAsync'dogs' 'cats' 'octocats'askTheUserIfTheyLikeThiselementnextlikesIt;;thenshowTheUserThingsTheyLikenewArr;;;
npm install array-async
'use strict';var ArrayAsync = require'async-array'filterAsync;filterAsync'dogs' 'cats' 'octocats'askTheUserIfTheyLikeThiselementnextlikesIt;;thenshowTheUserThingsTheyLikenewArr;;;
I'm not sure which is the clear win yet:
Call each *Async function as needed
var mapAsync = require'array-async'mapAsync;
Use them attached to ArrayAsync object
var ArrayAsync = require'array-async'ArrayAsync;// Access each without the trailing 'Async'ArrayAsyncreducearr fn;
Attach the async methods to Array
I've been the prototype route before... it was a bad idea.