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 arrayAggregator from './_arrayAggregator.js';
import baseAggregator from './_baseAggregator.js';
import isArray from './isArray.js';
/**
* Creates a function like `groupBy`.
@@ -12,7 +11,7 @@ import isArray from './isArray.js';
*/
function createAggregator(setter, initializer) {
return (collection, iteratee) => {
const func = isArray(collection) ? arrayAggregator : baseAggregator;
const func = Array.isArray(collection) ? arrayAggregator : baseAggregator;
const accumulator = initializer ? initializer() : {};
return func(collection, setter, iteratee, accumulator);
};