Ramda Adjunct 1.14.0

concatRight.js

  1. import { concat, flip } from 'ramda';
  2. /**
  3. * Returns the result of concatenating the given lists or strings.
  4. *
  5. * Note: R.concat expects both arguments to be of the same type, unlike
  6. * the native Array.prototype.concat method.
  7. * It will throw an error if you concat an Array with a non-Array value.
  8. * Dispatches to the concat method of the second argument, if present.
  9. *
  10. * @func concatRight
  11. * @memberOf RA
  12. * @since {@link https://char0n.github.io/ramda-adjunct/1.11.0|v1.11.0}
  13. * @category List
  14. * @sig
  15. *
  16. * [a] → [a] → [a]
  17. * String → String → String
  18. *
  19. * @param {Array|String} firstList The first list
  20. * @param {Array|String} secondList The second list
  21. * @return {Array|String} A list consisting of the elements of `secondList`
  22. * followed by the elements of `firstList`.
  23. * @see {@link http://ramdajs.com/docs/#concat|concat}
  24. * @example
  25. *
  26. * RA.concatRight('ABC', 'DEF'); // 'DEFABC'
  27. * RA.concatRight([4, 5, 6], [1, 2, 3]); //=> [1, 2, 3, 4, 5, 6]
  28. * RA.concatRight([], []); //=> []
  29. */
  30. const concatRight = flip(concat);
  31. export default concatRight;