array-first

1.0.2 • Public • Published

array-first NPM version Build Status

Get the first element or first n elements of an array.

(TOC generated by verb using markdown-toc)

Usage

var first = require('array-first');
 
first(['a', 'b', 'c', 'd', 'e', 'f']);
//=> 'a'
 
first(['a', 'b', 'c', 'd', 'e', 'f'], 1);
//=> 'a'
 
first(['a', 'b', 'c', 'd', 'e', 'f'], 3);
//=> ['a', 'b', 'c']

Related projects

array-last: Get the last or last n elements in an array. | homepage

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright © 2016 Jon Schlinkert Released under the MIT license.


This file was generated by verb on January 12, 2016.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    24
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    24
  • 1.0.1
    0
  • 1.0.0
    1

Package Sidebar

Install

npm i array-first

Weekly Downloads

25

Version

1.0.2

License

MIT

Last publish

Collaborators

  • doowb
  • jonschlinkert