UNPKG

bit-bin

Version:

<a href="https://opensource.org/licenses/Apache-2.0"><img alt="apache" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a> <a href="https://github.com/teambit/bit/blob/master/CONTRIBUTING.md"><img alt="prs" src="https://img.shields.io/b

22 lines (20 loc) 404 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = first; /** * returns the first element of an array. * @name first * @param {[]} array * @returns {[]} the first element of given array * @example * ```js * first([1,2,3]) // => 1 * first([]) // => null * ``` */ function first(array) { if (array && array[0]) return array[0]; return null; }