From 0574aa90d696e22e5c870192ba8ec22e4e0e9eb2 Mon Sep 17 00:00:00 2001 From: Graeme Yeates Date: Sat, 1 Aug 2015 15:37:41 -0400 Subject: Allow map to return objects --- lib/async.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') 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; -- cgit v1.2.1