|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
758 bytes
|
| Line | |
|---|
| 1 | var 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 | */
|
|---|
| 12 | function 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 |
|
|---|
| 30 | module.exports = baseSortedUniq;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.