# array-first [![NPM version](https://img.shields.io/npm/v/array-first.svg)](https://www.npmjs.com/package/array-first) [![Build Status](https://img.shields.io/travis/jonschlinkert/array-first.svg)](https://travis-ci.org/jonschlinkert/array-first) > Get the first element or first n elements of an array. - [Usage](#usage) - [Related projects](#related-projects) - [Running tests](#running-tests) - [Contributing](#contributing) - [Author](#author) - [License](#license) _(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ ## Usage ```js 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](https://www.npmjs.com/package/array-last): Get the last or last n elements in an array. | [homepage](https://github.com/jonschlinkert/array-last) ## Running tests Install dev dependencies: ```sh $ npm i -d && npm test ``` ## Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/array-first/issues/new). ## Author **Jon Schlinkert** * [github/jonschlinkert](https://github.com/jonschlinkert) * [twitter/jonschlinkert](http://twitter.com/jonschlinkert) ## License Copyright © 2016 [Jon Schlinkert](https://github.com/jonschlinkert) Released under the MIT license. *** _This file was generated by [verb](https://github.com/verbose/verb) on January 12, 2016._