mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 20:07:49 +00:00
Remove isIterateeCall.
This commit is contained in:
10
chunk.js
10
chunk.js
@@ -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 []
|
||||
|
||||
Reference in New Issue
Block a user