mirror of https://github.com/lukechilds/node.git
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.
21 lines
377 B
21 lines
377 B
10 years ago
|
var dropRight = require('./dropRight');
|
||
|
|
||
|
/**
|
||
|
* Gets all but the last element of `array`.
|
||
|
*
|
||
|
* @static
|
||
|
* @memberOf _
|
||
|
* @category Array
|
||
|
* @param {Array} array The array to query.
|
||
|
* @returns {Array} Returns the slice of `array`.
|
||
|
* @example
|
||
|
*
|
||
|
* _.initial([1, 2, 3]);
|
||
|
* // => [1, 2]
|
||
|
*/
|
||
|
function initial(array) {
|
||
|
return dropRight(array, 1);
|
||
|
}
|
||
|
|
||
|
module.exports = initial;
|