Apply more let/const transforms.

This commit is contained in:
John-David Dalton
2017-01-08 23:38:19 -08:00
parent ca9e6fa087
commit 4d0c15b49e
115 changed files with 621 additions and 613 deletions

View File

@@ -6,7 +6,7 @@ import baseUnary from './_baseUnary.js';
import cacheHas from './_cacheHas.js';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin = Math.min;
const nativeMin = Math.min;
/**
* The base implementation of methods like `_.intersection`, without support
@@ -19,13 +19,14 @@ var nativeMin = Math.min;
* @returns {Array} Returns the new array of shared values.
*/
function baseIntersection(arrays, iteratee, comparator) {
var includes = comparator ? arrayIncludesWith : arrayIncludes,
length = arrays[0].length,
othLength = arrays.length,
othIndex = othLength,
caches = Array(othLength),
maxLength = Infinity,
result = [];
const includes = comparator ? arrayIncludesWith : arrayIncludes;
const length = arrays[0].length;
const othLength = arrays.length;
const caches = Array(othLength);
const result = [];
let maxLength = Infinity;
let othIndex = othLength;
while (othIndex--) {
var array = arrays[othIndex];
@@ -39,13 +40,13 @@ function baseIntersection(arrays, iteratee, comparator) {
}
array = arrays[0];
var index = -1,
seen = caches[0];
let index = -1;
const seen = caches[0];
outer:
while (++index < length && result.length < maxLength) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
let value = array[index];
const computed = iteratee ? iteratee(value) : value;
value = (comparator || value !== 0) ? value : 0;
if (!(seen
@@ -54,7 +55,7 @@ function baseIntersection(arrays, iteratee, comparator) {
)) {
othIndex = othLength;
while (--othIndex) {
var cache = caches[othIndex];
const cache = caches[othIndex];
if (!(cache
? cacheHas(cache, computed)
: includes(arrays[othIndex], computed, comparator))