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.

39 lines
921 B

4 years ago
  1. import _checkForMethod from "./internal/_checkForMethod.js";
  2. import _curry1 from "./internal/_curry1.js";
  3. import slice from "./slice.js";
  4. /**
  5. * Returns all but the first element of the given list or string (or object
  6. * with a `tail` method).
  7. *
  8. * Dispatches to the `slice` method of the first argument, if present.
  9. *
  10. * @func
  11. * @memberOf R
  12. * @since v0.1.0
  13. * @category List
  14. * @sig [a] -> [a]
  15. * @sig String -> String
  16. * @param {*} list
  17. * @return {*}
  18. * @see R.head, R.init, R.last
  19. * @example
  20. *
  21. * R.tail([1, 2, 3]); //=> [2, 3]
  22. * R.tail([1, 2]); //=> [2]
  23. * R.tail([1]); //=> []
  24. * R.tail([]); //=> []
  25. *
  26. * R.tail('abc'); //=> 'bc'
  27. * R.tail('ab'); //=> 'b'
  28. * R.tail('a'); //=> ''
  29. * R.tail(''); //=> ''
  30. */
  31. var tail =
  32. /*#__PURE__*/
  33. _curry1(
  34. /*#__PURE__*/
  35. _checkForMethod('tail',
  36. /*#__PURE__*/
  37. slice(1, Infinity)));
  38. export default tail;