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.

29 lines
877 B

4 years ago
  1. import _concat from "./internal/_concat.js";
  2. import _curry2 from "./internal/_curry2.js";
  3. /**
  4. * Returns a new list containing the contents of the given list, followed by
  5. * the given element.
  6. *
  7. * @func
  8. * @memberOf R
  9. * @since v0.1.0
  10. * @category List
  11. * @sig a -> [a] -> [a]
  12. * @param {*} el The element to add to the end of the new list.
  13. * @param {Array} list The list of elements to add a new item to.
  14. * list.
  15. * @return {Array} A new list containing the elements of the old list followed by `el`.
  16. * @see R.prepend
  17. * @example
  18. *
  19. * R.append('tests', ['write', 'more']); //=> ['write', 'more', 'tests']
  20. * R.append('tests', []); //=> ['tests']
  21. * R.append(['tests'], ['write', 'more']); //=> ['write', 'more', ['tests']]
  22. */
  23. var append =
  24. /*#__PURE__*/
  25. _curry2(function append(el, list) {
  26. return _concat(list, [el]);
  27. });
  28. export default append;