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.

34 lines
929 B

4 years ago
  1. import _curry1 from "./internal/_curry1.js";
  2. import _dispatchable from "./internal/_dispatchable.js";
  3. import _xdropRepeatsWith from "./internal/_xdropRepeatsWith.js";
  4. import dropRepeatsWith from "./dropRepeatsWith.js";
  5. import equals from "./equals.js";
  6. /**
  7. * Returns a new list without any consecutively repeating elements.
  8. * [`R.equals`](#equals) is used to determine equality.
  9. *
  10. * Acts as a transducer if a transformer is given in list position.
  11. *
  12. * @func
  13. * @memberOf R
  14. * @since v0.14.0
  15. * @category List
  16. * @sig [a] -> [a]
  17. * @param {Array} list The array to consider.
  18. * @return {Array} `list` without repeating elements.
  19. * @see R.transduce
  20. * @example
  21. *
  22. * R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2]
  23. */
  24. var dropRepeats =
  25. /*#__PURE__*/
  26. _curry1(
  27. /*#__PURE__*/
  28. _dispatchable([],
  29. /*#__PURE__*/
  30. _xdropRepeatsWith(equals),
  31. /*#__PURE__*/
  32. dropRepeatsWith(equals)));
  33. export default dropRepeats;