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 */ 18function first(array) { 19 return array ? array[0] : undefined; 20} 21 22module.exports = first; 23 24