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.

sortedUniqBy.js 698B

1234567891011121314151617181920212223242526
  1. var baseIteratee = require('./_baseIteratee'),
  2. baseSortedUniq = require('./_baseSortedUniq');
  3. /**
  4. * This method is like `_.uniqBy` except that it's designed and optimized
  5. * for sorted arrays.
  6. *
  7. * @static
  8. * @memberOf _
  9. * @since 4.0.0
  10. * @category Array
  11. * @param {Array} array The array to inspect.
  12. * @param {Function} [iteratee] The iteratee invoked per element.
  13. * @returns {Array} Returns the new duplicate free array.
  14. * @example
  15. *
  16. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  17. * // => [1.1, 2.3]
  18. */
  19. function sortedUniqBy(array, iteratee) {
  20. return (array && array.length)
  21. ? baseSortedUniq(array, baseIteratee(iteratee, 2))
  22. : [];
  23. }
  24. module.exports = sortedUniqBy;