summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwebbiesdk <erik@webbies.dk>2017-03-13 10:34:06 +0100
committerGitHub <noreply@github.com>2017-03-13 10:34:06 +0100
commitaa3fbfeedfd780aa1b39e333a7f56a2534ffd977 (patch)
treed6d67dd9205ef81381891b7cd62d4a90a5f8f508
parentbdc3d814b3eb574fa6ab2824fc19b3acf0c35d2c (diff)
downloadasync-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.js2
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) ? [] : {};