mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Apply even more let/const transforms.
This commit is contained in:
12
chunk.js
12
chunk.js
@@ -3,8 +3,8 @@ import isIterateeCall from './_isIterateeCall.js';
|
||||
import toInteger from './toInteger.js';
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeCeil = Math.ceil,
|
||||
nativeMax = Math.max;
|
||||
const nativeCeil = Math.ceil;
|
||||
const nativeMax = Math.max;
|
||||
|
||||
/**
|
||||
* Creates an array of elements split into groups the length of `size`.
|
||||
@@ -33,13 +33,13 @@ function chunk(array, size, guard) {
|
||||
} else {
|
||||
size = nativeMax(toInteger(size), 0);
|
||||
}
|
||||
var length = array == null ? 0 : array.length;
|
||||
const length = array == null ? 0 : array.length;
|
||||
if (!length || size < 1) {
|
||||
return [];
|
||||
}
|
||||
var index = 0,
|
||||
resIndex = 0,
|
||||
result = Array(nativeCeil(length / size));
|
||||
let index = 0;
|
||||
let resIndex = 0;
|
||||
const result = Array(nativeCeil(length / size));
|
||||
|
||||
while (index < length) {
|
||||
result[resIndex++] = baseSlice(array, index, (index += size));
|
||||
|
||||
Reference in New Issue
Block a user