mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
react app
This commit is contained in:
60
react-app/node_modules/lodash/internal/baseUniq.js
generated
vendored
Normal file
60
react-app/node_modules/lodash/internal/baseUniq.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
var baseIndexOf = require('./baseIndexOf'),
|
||||
cacheIndexOf = require('./cacheIndexOf'),
|
||||
createCache = require('./createCache');
|
||||
|
||||
/** Used as the size to enable large array optimizations. */
|
||||
var LARGE_ARRAY_SIZE = 200;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.uniq` without support for callback shorthands
|
||||
* and `this` binding.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {Function} [iteratee] The function invoked per iteration.
|
||||
* @returns {Array} Returns the new duplicate free array.
|
||||
*/
|
||||
function baseUniq(array, iteratee) {
|
||||
var index = -1,
|
||||
indexOf = baseIndexOf,
|
||||
length = array.length,
|
||||
isCommon = true,
|
||||
isLarge = isCommon && length >= LARGE_ARRAY_SIZE,
|
||||
seen = isLarge ? createCache() : null,
|
||||
result = [];
|
||||
|
||||
if (seen) {
|
||||
indexOf = cacheIndexOf;
|
||||
isCommon = false;
|
||||
} else {
|
||||
isLarge = false;
|
||||
seen = iteratee ? [] : result;
|
||||
}
|
||||
outer:
|
||||
while (++index < length) {
|
||||
var value = array[index],
|
||||
computed = iteratee ? iteratee(value, index, array) : value;
|
||||
|
||||
if (isCommon && value === value) {
|
||||
var seenIndex = seen.length;
|
||||
while (seenIndex--) {
|
||||
if (seen[seenIndex] === computed) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
if (iteratee) {
|
||||
seen.push(computed);
|
||||
}
|
||||
result.push(value);
|
||||
}
|
||||
else if (indexOf(seen, computed, 0) < 0) {
|
||||
if (iteratee || isLarge) {
|
||||
seen.push(computed);
|
||||
}
|
||||
result.push(value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = baseUniq;
|
Reference in New Issue
Block a user