Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80742 views
1
var dropRight = require('./dropRight');
2
3
/**
4
* Gets all but the last element of `array`.
5
*
6
* @static
7
* @memberOf _
8
* @category Array
9
* @param {Array} array The array to query.
10
* @returns {Array} Returns the slice of `array`.
11
* @example
12
*
13
* _.initial([1, 2, 3]);
14
* // => [1, 2]
15
*/
16
function initial(array) {
17
return dropRight(array, 1);
18
}
19
20
module.exports = initial;
21
22