Urara-Blog/node_modules/.pnpm-store/v3/files/09/06a64fc9a87422b29825daa40e6785f6ea030256401853cf188773c376e2d5736f8ede1d1cf8b5e9b329fab9936cdac218ce68eb8063a11df61aa1dfa959dd
2022-08-14 01:14:53 +08:00

30 lines
758 B
Text

var eq = require('./eq');
/**
* The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
* support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @returns {Array} Returns the new duplicate free array.
*/
function baseSortedUniq(array, iteratee) {
var index = -1,
length = array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
if (!index || !eq(computed, seen)) {
var seen = computed;
result[resIndex++] = value === 0 ? 0 : value;
}
}
return result;
}
module.exports = baseSortedUniq;