rest.js 369 B

123456789101112131415161718192021
  1. var drop = require('./drop');
  2. /**
  3. * Gets all but the first element of `array`.
  4. *
  5. * @static
  6. * @memberOf _
  7. * @alias tail
  8. * @category Array
  9. * @param {Array} array The array to query.
  10. * @returns {Array} Returns the slice of `array`.
  11. * @example
  12. *
  13. * _.rest([1, 2, 3]);
  14. * // => [2, 3]
  15. */
  16. function rest(array) {
  17. return drop(array, 1);
  18. }
  19. module.exports = rest;