summaryrefslogtreecommitdiff
path: root/lib/internal/map.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/internal/map.js')
-rw-r--r--lib/internal/map.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/internal/map.js b/lib/internal/map.js
index 45c3eae..2c2a750 100644
--- a/lib/internal/map.js
+++ b/lib/internal/map.js
@@ -1,13 +1,14 @@
-import isArrayLike from 'lodash/isArrayLike';
-import getIterator from './getIterator';
import noop from 'lodash/noop';
import once from './once';
export default function _asyncMap(eachfn, arr, iteratee, callback) {
callback = once(callback || noop);
arr = arr || [];
- var results = isArrayLike(arr) || getIterator(arr) ? [] : {};
- eachfn(arr, function (value, index, callback) {
+ var results = [];
+ var counter = 0;
+
+ eachfn(arr, function (value, _, callback) {
+ var index = counter++;
iteratee(value, function (err, v) {
results[index] = v;
callback(err);