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 arrayFilter from './_arrayFilter.js';
import baseFilter from './_baseFilter.js';
import isArray from './isArray.js';
/**
* Iterates over elements of `collection`, returning an array of all elements
@@ -27,7 +26,7 @@ import isArray from './isArray.js';
* // => objects for ['fred']
*/
function filter(collection, predicate) {
const func = isArray(collection) ? arrayFilter : baseFilter;
const func = Array.isArray(collection) ? arrayFilter : baseFilter;
return func(collection, predicate);
}