The Wayback Machine - https://web.archive.org/web/20170626183734/https://github.com/lodash/lodash/blob/master/tail.js
Skip to content
Permalink
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (21 sloc) 417 Bytes
/**
* Gets all but the first element of `array`.
*
* @since 4.0.0
* @category Array
* @param {Array} array The array to query.
* @returns {Array} Returns the slice of `array`.
* @example
*
* tail([1, 2, 3])
* // => [2, 3]
*/
function tail(array) {
const length = array == null ? 0 : array.length
if (!length) {
return []
}
const [head, ...result] = array
return result
}
export default tail
You can't perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.