diff --git a/lodash.src.js b/lodash.src.js index d8520b05b..f8832a5bd 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -4527,7 +4527,7 @@ if (guard ? isIterateeCall(array, size, guard) : size == null) { size = 1; } else { - size = nativeMax(+size || 1, 1); + size = nativeMax(floor(size) || 1, 1); } var index = 0, length = array ? array.length : 0, diff --git a/test/test.js b/test/test.js index 0076944ba..9ac8952d3 100644 --- a/test/test.js +++ b/test/test.js @@ -1846,6 +1846,10 @@ deepEqual(actual, expected); }); + test('should floor `size` values', 1, function() { + deepEqual(_.chunk(array, array.length / 4), [[0], [1], [2], [3], [4], [5]]); + }); + test('should work as an iteratee for methods like `_.map`', 1, function() { var actual = _.map([[1, 2], [3, 4]], _.chunk); deepEqual(actual, [[[1], [2]], [[3], [4]]]);