Remove isIterateeCall.

This commit is contained in:
John-David Dalton
2017-03-03 23:32:24 -08:00
parent ba52c744ae
commit 17f7069d07
11 changed files with 11 additions and 93 deletions

View File

@@ -1,5 +1,4 @@
import baseSlice from './.internal/baseSlice.js'
import isIterateeCall from './.internal/isIterateeCall.js'
import toInteger from './toInteger.js'
/* Built-in method references for those with the same name as other `lodash` methods. */
@@ -15,7 +14,6 @@ const nativeMax = Math.max
* @category Array
* @param {Array} array The array to process.
* @param {number} [size=1] The length of each chunk
* @param- {Object} [guard] Enables use as an iteratee for methods like `map`.
* @returns {Array} Returns the new array of chunks.
* @example
*
@@ -25,12 +23,8 @@ const nativeMax = Math.max
* chunk(['a', 'b', 'c', 'd'], 3)
* // => [['a', 'b', 'c'], ['d']]
*/
function chunk(array, size, guard) {
if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
size = 1
} else {
size = nativeMax(toInteger(size), 0)
}
function chunk(array, size) {
size = nativeMax(toInteger(size), 0)
const length = array == null ? 0 : array.length
if (!length || size < 1) {
return []