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.

sortedUniq.js 513B

123456789101112131415161718192021222324
  1. var baseSortedUniq = require('./_baseSortedUniq');
  2. /**
  3. * This method is like `_.uniq` except that it's designed and optimized
  4. * for sorted arrays.
  5. *
  6. * @static
  7. * @memberOf _
  8. * @since 4.0.0
  9. * @category Array
  10. * @param {Array} array The array to inspect.
  11. * @returns {Array} Returns the new duplicate free array.
  12. * @example
  13. *
  14. * _.sortedUniq([1, 1, 2]);
  15. * // => [1, 2]
  16. */
  17. function sortedUniq(array) {
  18. return (array && array.length)
  19. ? baseSortedUniq(array)
  20. : [];
  21. }
  22. module.exports = sortedUniq;