Socket
Socket
Sign inDemoInstall

array-head

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    array-head

Returns the first element of the array or `undefined` if given an empty or non-array value.


Version published
Maintainers
1
Install size
4.87 kB
Created

Changelog

Source

0.1.0 - 2015-08-04

Added

  • Initial Version.

Readme

Source

array-head

Returns the first element of the array or undefined given an empty or non-array value.

Build Status Code Climate js-standard-style

npm install array-head --save

You can also use Duo, Bower or download the files manually.

npm stats

npm NPM downloads Dependency Status

API Example

Pointful
var first = require('array-head')
first([25, 20, 15, 10])
//=> 25
Pointfree 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 or undefined given an empty or non-array value.

Alternatives

  • x => x[0]
  • function (x) { return x[0] }

Contributing

SEE: contributing.md

Licenses

GitHub license

Keywords

FAQs

Last updated on 04 Aug 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc