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.

22 lines
457 B

4 years ago
  1. var baseSlice = require('./_baseSlice');
  2. /**
  3. * Gets all but the first element of `array`.
  4. *
  5. * @static
  6. * @memberOf _
  7. * @since 4.0.0
  8. * @category Array
  9. * @param {Array} array The array to query.
  10. * @returns {Array} Returns the slice of `array`.
  11. * @example
  12. *
  13. * _.tail([1, 2, 3]);
  14. * // => [2, 3]
  15. */
  16. function tail(array) {
  17. var length = array == null ? 0 : array.length;
  18. return length ? baseSlice(array, 1, length) : [];
  19. }
  20. module.exports = tail;