mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Use Array.isArray.
This commit is contained in:
3
map.js
3
map.js
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user