projects
/
yaffs-website
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
b3b9c79c7bba5d81cc1e6276d3a1013871b865af
[yaffs-website]
/
first.js
1
/**
2
* Gets the first element of `array`.
3
*
4
* @static
5
* @memberOf _
6
* @alias head
7
* @category Array
8
* @param {Array} array The array to query.
9
* @returns {*} Returns the first element of `array`.
10
* @example
11
*
12
* _.first([1, 2, 3]);
13
* // => 1
14
*
15
* _.first([]);
16
* // => undefined
17
*/
18
function first(array) {
19
return array ? array[0] : undefined;
20
}
21
22
module.exports = first;