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