mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Use Array.isArray.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import arrayEach from './_arrayEach.js';
|
||||
import baseEach from './_baseEach.js';;
|
||||
import isArray from './isArray.js';
|
||||
|
||||
/**
|
||||
* Iterates over elements of `collection` and invokes `iteratee` for each element.
|
||||
@@ -32,7 +31,7 @@ import isArray from './isArray.js';
|
||||
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
||||
*/
|
||||
function forEach(collection, iteratee) {
|
||||
const func = isArray(collection) ? arrayEach : baseEach;
|
||||
const func = Array.isArray(collection) ? arrayEach : baseEach;
|
||||
return func(collection, iteratee);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user