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

View File

@@ -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);
}