diff options
author | Graeme Yeates <yeatesgraeme@gmail.com> | 2015-08-01 15:37:41 -0400 |
---|---|---|
committer | Graeme Yeates <yeatesgraeme@gmail.com> | 2015-08-01 15:44:11 -0400 |
commit | 0574aa90d696e22e5c870192ba8ec22e4e0e9eb2 (patch) | |
tree | fa18563af711b761ff75d10ff53b23882d2086c5 /lib/async.js | |
parent | 1f97538586e09ce76168fa1ceb04288fd958b0a0 (diff) | |
download | async-0574aa90d696e22e5c870192ba8ec22e4e0e9eb2.tar.gz |
Allow map to return objectsobject-map
Diffstat (limited to 'lib/async.js')
-rw-r--r-- | lib/async.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/async.js b/lib/async.js index 9c2b6af..208e602 100644 --- a/lib/async.js +++ b/lib/async.js @@ -353,7 +353,8 @@ function _asyncMap(eachfn, arr, iterator, callback) { callback = _once(callback || noop); - var results = []; + arr = arr || []; + var results = _isArrayLike(arr) ? [] : {}; eachfn(arr, function (value, index, callback) { iterator(value, function (err, v) { results[index] = v; |