diff options
author | webbiesdk <erik@webbies.dk> | 2017-03-13 10:34:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-13 10:34:06 +0100 |
commit | aa3fbfeedfd780aa1b39e333a7f56a2534ffd977 (patch) | |
tree | d6d67dd9205ef81381891b7cd62d4a90a5f8f508 | |
parent | bdc3d814b3eb574fa6ab2824fc19b3acf0c35d2c (diff) | |
download | async-aa3fbfeedfd780aa1b39e333a7f56a2534ffd977.tar.gz |
Make async.transform actually support 2 arguments
The documentation suggests that both the `accumulator` and `callback` arguments to transform is optional.
However, if both are left out (and transform therefore is called with only 2 arguments), transform crashes with a `iteratee is not a function` exception.
This fixes that.
-rw-r--r-- | lib/transform.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/transform.js b/lib/transform.js index 5d1342a..f001c51 100644 --- a/lib/transform.js +++ b/lib/transform.js @@ -50,7 +50,7 @@ import once from './internal/once'; * }) */ export default function transform (coll, accumulator, iteratee, callback) { - if (arguments.length === 3) { + if (arguments.length <= 3) { callback = iteratee; iteratee = accumulator; accumulator = isArray(coll) ? [] : {}; |