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 createSet from './_createSet.js';
import setToArray from './_setToArray.js';
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
const LARGE_ARRAY_SIZE = 200;
/**
* The base implementation of `_.uniqBy` without support for iteratee shorthands.
@@ -18,19 +18,20 @@ var LARGE_ARRAY_SIZE = 200;
* @returns {Array} Returns the new duplicate free array.
*/
function baseUniq(array, iteratee, comparator) {
var index = -1,
includes = arrayIncludes,
length = array.length,
isCommon = true,
result = [],
seen = result;
let index = -1;
let includes = arrayIncludes;
let isCommon = true;
const length = array.length;
const result = [];
let seen = result;
if (comparator) {
isCommon = false;
includes = arrayIncludesWith;
}
else if (length >= LARGE_ARRAY_SIZE) {
var set = iteratee ? null : createSet(array);
const set = iteratee ? null : createSet(array);
if (set) {
return setToArray(set);
}
@@ -43,12 +44,12 @@ function baseUniq(array, iteratee, comparator) {
}
outer:
while (++index < length) {
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 (isCommon && computed === computed) {
var seenIndex = seen.length;
let seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;