Use Array.isArray.

This commit is contained in:
John-David Dalton
2017-01-09 18:44:38 -08:00
parent 395a81058b
commit 68190b8546
31 changed files with 34 additions and 64 deletions

3
map.js
View File

@@ -1,6 +1,5 @@
import arrayMap from './_arrayMap.js';
import baseMap from './_baseMap.js';
import isArray from './isArray.js';
/**
* Creates an array of values by running each element in `collection` thru
@@ -35,7 +34,7 @@ import isArray from './isArray.js';
* // => [16, 64] (iteration order is not guaranteed)
*/
function map(collection, iteratee) {
const func = isArray(collection) ? arrayMap : baseMap;
const func = Array.isArray(collection) ? arrayMap : baseMap;
return func(collection, iteratee);
}