mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Remove semicolons.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import SetCache from './SetCache.js';
|
||||
import arrayIncludes from './arrayIncludes.js';
|
||||
import arrayIncludesWith from './arrayIncludesWith.js';
|
||||
import cacheHas from './cacheHas.js';
|
||||
import createSet from './createSet.js';
|
||||
import setToArray from './setToArray.js';
|
||||
import SetCache from './SetCache.js'
|
||||
import arrayIncludes from './arrayIncludes.js'
|
||||
import arrayIncludesWith from './arrayIncludesWith.js'
|
||||
import cacheHas from './cacheHas.js'
|
||||
import createSet from './createSet.js'
|
||||
import setToArray from './setToArray.js'
|
||||
|
||||
/** Used as the size to enable large array optimizations. */
|
||||
const LARGE_ARRAY_SIZE = 200;
|
||||
const LARGE_ARRAY_SIZE = 200
|
||||
|
||||
/**
|
||||
* The base implementation of `uniqBy`.
|
||||
@@ -18,56 +18,56 @@ const LARGE_ARRAY_SIZE = 200;
|
||||
* @returns {Array} Returns the new duplicate free array.
|
||||
*/
|
||||
function baseUniq(array, iteratee, comparator) {
|
||||
let index = -1;
|
||||
let includes = arrayIncludes;
|
||||
let isCommon = true;
|
||||
let index = -1
|
||||
let includes = arrayIncludes
|
||||
let isCommon = true
|
||||
|
||||
const length = array.length;
|
||||
const result = [];
|
||||
let seen = result;
|
||||
const length = array.length
|
||||
const result = []
|
||||
let seen = result
|
||||
|
||||
if (comparator) {
|
||||
isCommon = false;
|
||||
includes = arrayIncludesWith;
|
||||
isCommon = false
|
||||
includes = arrayIncludesWith
|
||||
}
|
||||
else if (length >= LARGE_ARRAY_SIZE) {
|
||||
const set = iteratee ? null : createSet(array);
|
||||
const set = iteratee ? null : createSet(array)
|
||||
if (set) {
|
||||
return setToArray(set);
|
||||
return setToArray(set)
|
||||
}
|
||||
isCommon = false;
|
||||
includes = cacheHas;
|
||||
seen = new SetCache;
|
||||
isCommon = false
|
||||
includes = cacheHas
|
||||
seen = new SetCache
|
||||
}
|
||||
else {
|
||||
seen = iteratee ? [] : result;
|
||||
seen = iteratee ? [] : result
|
||||
}
|
||||
outer:
|
||||
while (++index < length) {
|
||||
let value = array[index];
|
||||
const computed = iteratee ? iteratee(value) : value;
|
||||
let value = array[index]
|
||||
const computed = iteratee ? iteratee(value) : value
|
||||
|
||||
value = (comparator || value !== 0) ? value : 0;
|
||||
value = (comparator || value !== 0) ? value : 0
|
||||
if (isCommon && computed === computed) {
|
||||
let seenIndex = seen.length;
|
||||
let seenIndex = seen.length
|
||||
while (seenIndex--) {
|
||||
if (seen[seenIndex] === computed) {
|
||||
continue outer;
|
||||
continue outer
|
||||
}
|
||||
}
|
||||
if (iteratee) {
|
||||
seen.push(computed);
|
||||
seen.push(computed)
|
||||
}
|
||||
result.push(value);
|
||||
result.push(value)
|
||||
}
|
||||
else if (!includes(seen, computed, comparator)) {
|
||||
if (seen !== result) {
|
||||
seen.push(computed);
|
||||
seen.push(computed)
|
||||
}
|
||||
result.push(value);
|
||||
result.push(value)
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return result
|
||||
}
|
||||
|
||||
export default baseUniq;
|
||||
export default baseUniq
|
||||
|
||||
Reference in New Issue
Block a user