0.1.0 • Published 10 years ago
array-head v0.1.0
array-head
Returns the first element of the array or
undefinedgiven an empty or non-array value.
npm install array-head --saveYou can also use Duo, Bower or download the files manually.
npm stats
API Example
Pointful
var first = require('array-head')
first([25, 20, 15, 10])
//=> 25Pointfree Style
var first = require('array-head')
var lists = [
['a', 'b', 'c'],
[1, 2, 3]
]
lists.map(first)
//=> ['a', 1]API
first(val)
arguments
val (Array)Array.
returns
(*)First element of the array orundefinedgiven an empty or non-array value.
Alternatives
x => x[0]function (x) { return x[0] }
Contributing
SEE: contributing.md
Licenses
0.1.0
10 years ago