source: trip-planner-front/node_modules/lodash/_baseSortedUniq.js@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 758 bytes
Line 
1var eq = require('./eq');
2
3/**
4 * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
5 * support for iteratee shorthands.
6 *
7 * @private
8 * @param {Array} array The array to inspect.
9 * @param {Function} [iteratee] The iteratee invoked per element.
10 * @returns {Array} Returns the new duplicate free array.
11 */
12function baseSortedUniq(array, iteratee) {
13 var index = -1,
14 length = array.length,
15 resIndex = 0,
16 result = [];
17
18 while (++index < length) {
19 var value = array[index],
20 computed = iteratee ? iteratee(value) : value;
21
22 if (!index || !eq(computed, seen)) {
23 var seen = computed;
24 result[resIndex++] = value === 0 ? 0 : value;
25 }
26 }
27 return result;
28}
29
30module.exports = baseSortedUniq;
Note: See TracBrowser for help on using the repository browser.