Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

array-head

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

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.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15
increased by87.5%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 04 Aug 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc