Skip to content


AsyncMap error result question #3

dannycoates opened this Issue · 2 comments

2 participants


I love the simplicity of your slide functions and I have a question about the implementation. I don't see a case where the cb_ function is called with an errState. It looks like the chain of callbacks is short circuited and cb_ is never invoked when there's an error. Is this by design or am I incorrect? I've commented the line in question below. Thanks! Great slides btw, very informative!

module.exports = asyncMap
function asyncMap (list, fn, cb_) {
  var n = list.length
    , results = []
    , errState = null
  function cb (er, data) {
    if (errState) return
    if (er) return cb(errState = er) //should this be cb_ ?
    if (-- n === 0)
      return cb_(null, results)
  if (list.length === 0) return cb_(null, [])
  list.forEach(function (l) {
    fn(l, cb)
npm member

Yep, that's a bug.

npm member

Closed by 5846d8e typo

@isaacs isaacs added a commit that referenced this issue
@isaacs isaacs bump version for GH-3 typo 7cc9247
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.