Skip to content

Instantly share code, notes, and snippets.

@barodeur
Last active December 15, 2015 02:39
Show Gist options
  • Save barodeur/5188617 to your computer and use it in GitHub Desktop.
Save barodeur/5188617 to your computer and use it in GitHub Desktop.
async = require 'async'
arr = [1, 2, 3, 4, 5, 6]
async.reduce(
[
(i, cb) -> cb(null, i * 2)
(i, cb) -> cb(null, i + 1)
]
(i, cb) -> cb(null, i)
(f, g, cb) ->
cb(
null
(i, kb) ->
f i, (err, j) ->
g j, kb
)
(err, fn) ->
async.map(
arr
fn
(err, results) ->
console.log results
)
)
# => [ 3, 5, 7, 9, 11, 13 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment