diff --git a/lodash.js b/lodash.js index ef47add8c..81a603b6d 100644 --- a/lodash.js +++ b/lodash.js @@ -3125,7 +3125,7 @@ /*--------------------------------------------------------------------------*/ /** - * Creates an array of elements split into groups the length of `chunkSize`. + * 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. * @@ -3133,7 +3133,7 @@ * @memberOf _ * @category Array * @param {Array} array The array to process. - * @param {numer} [chunkSize=1] The size of each chunk. + * @param {numer} [size=1] The length of each chunk. * @returns {Array} Returns the new array containing chunks. * @example * @@ -3143,15 +3143,15 @@ * _.chunk(['a', 'b', 'c', 'd'], 3); * // => [['a', 'b', 'c'], ['d']] */ - function chunk(array, chunkSize) { + function chunk(array, size) { var index = 0, length = array ? array.length : 0, resIndex = -1, result = []; - chunkSize = nativeMax(+chunkSize || 1, 1); + size = typeof size == 'undefined' ? 1 : nativeMax(+size || 1, 1); while (index < length) { - result[++resIndex] = slice(array, index, (index += chunkSize)); + result[++resIndex] = slice(array, index, (index += size)); } return result; }