* Creates an array of elements split into groups the length of `size`. * If `collection` can't be split evenly, the final chunk will be the remaining * elements. * * @static * @memberOf _ * @category Array * @param {Array} array The array to process. * @param
(array, size, guard)
| 6019 | * // => [['a', 'b', 'c'], ['d']] |
| 6020 | */ |
| 6021 | function chunk(array, size, guard) { |
| 6022 | if (guard ? isIterateeCall(array, size, guard) : size == null) { |
| 6023 | size = 1; |
| 6024 | } else { |
| 6025 | size = nativeMax(+size || 1, 1); |
| 6026 | } |
| 6027 | var index = 0, |
| 6028 | length = array ? array.length : 0, |
| 6029 | resIndex = -1, |
| 6030 | result = Array(ceil(length / size)); |
| 6031 | |
| 6032 | while (index < length) { |
| 6033 | result[++resIndex] = baseSlice(array, index, (index += size)); |
| 6034 | } |
| 6035 | return result; |
| 6036 | } |
| 6037 | |
| 6038 | /** |
| 6039 | * Creates an array with all falsey values removed. The values `false`, `null`, |
nothing calls this directly
no test coverage detected