uniq.js 600 B

123456789101112131415161718192021222324
  1. import identity from "./identity.js";
  2. import uniqBy from "./uniqBy.js";
  3. /**
  4. * Returns a new list containing only one copy of each element in the original
  5. * list. [`R.equals`](#equals) is used to determine equality.
  6. *
  7. * @func
  8. * @memberOf R
  9. * @since v0.1.0
  10. * @category List
  11. * @sig [a] -> [a]
  12. * @param {Array} list The array to consider.
  13. * @return {Array} The list of unique items.
  14. * @example
  15. *
  16. * R.uniq([1, 1, 2, 1]); //=> [1, 2]
  17. * R.uniq([1, '1']); //=> [1, '1']
  18. * R.uniq([[42], [42]]); //=> [[42]]
  19. */
  20. var uniq =
  21. /*#__PURE__*/
  22. uniqBy(identity);
  23. export default uniq;