async icon indicating copy to clipboard operation
async copied to clipboard

applyEach does not work as described in the docs

Open sebastien-ma opened this issue 7 years ago • 1 comments

Hi,

I ran this issue when trying to use applyEach. Seems it does not behave as described in the docs.

What version of async are you using? 3.0.1

Which environment did the issue occur in (Node version/browser version) Node.js 10.15.3

What did you do? Please include a minimal reproducable case illustrating issue.

async.applyEach(
  [
    (a, b, done) => {
      done(null, a + b)
    },
    (a, b, done) => {
      done(null, a - b);
    }
  ],
  1, 1,
  (err, ret) => {
    console.log(err, ret)
  }
);

What did you expect to happen? Each function get executed. final callback called only one time after all functions executed.

What was the actual result? applyEach returns [function: awaitable], when invoked, the last argument callback was called for each function

sebastien-ma avatar Jun 05 '19 21:06 sebastien-ma

Ah, I forgot to update the example. Thanks for pointing this out.

aearly avatar Jun 05 '19 22:06 aearly