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