main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
459 bytes
|
Line | |
---|
1 | import baseSlice from './_baseSlice.js';
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Gets all but the last element of `array`.
|
---|
5 | *
|
---|
6 | * @static
|
---|
7 | * @memberOf _
|
---|
8 | * @since 0.1.0
|
---|
9 | * @category Array
|
---|
10 | * @param {Array} array The array to query.
|
---|
11 | * @returns {Array} Returns the slice of `array`.
|
---|
12 | * @example
|
---|
13 | *
|
---|
14 | * _.initial([1, 2, 3]);
|
---|
15 | * // => [1, 2]
|
---|
16 | */
|
---|
17 | function initial(array) {
|
---|
18 | var length = array == null ? 0 : array.length;
|
---|
19 | return length ? baseSlice(array, 0, -1) : [];
|
---|
20 | }
|
---|
21 |
|
---|
22 | export default initial;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.