Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_baseSortedUniq.js 758B

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