mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 08:57:49 +00:00
Apply more let/const transforms.
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user