https://github.com/jonschlinkert/array-initial
Get all but the last element or last n elements of an array.
https://github.com/jonschlinkert/array-initial
array elements initial items javascript
Last synced: 9 months ago
JSON representation
Get all but the last element or last n elements of an array.
- Host: GitHub
- URL: https://github.com/jonschlinkert/array-initial
- Owner: jonschlinkert
- License: mit
- Created: 2014-12-12T11:10:15.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2020-07-29T16:14:49.000Z (over 5 years ago)
- Last Synced: 2025-05-05T21:11:49.343Z (9 months ago)
- Topics: array, elements, initial, items, javascript
- Language: JavaScript
- Size: 7.81 KB
- Stars: 8
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# array-initial [](http://badge.fury.io/js/array-initial)
> Get all but the last element or last n elements of an array.
## Install with [npm](npmjs.org)
```bash
npm i array-initial --save
```
## Usage
```js
var initial = require('array-initial');
initial(['a', 'b', 'c', 'd', 'e', 'f']);
//=> ['a', 'b', 'c', 'd', 'e']
initial(['a', 'b', 'c', 'd', 'e', 'f'], 1);
//=> ['a', 'b', 'c', 'd', 'e']
initial(['a', 'b', 'c', 'd', 'e', 'f'], 2);
//=> ['a', 'b', 'c', 'd']
```
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright (c) 2014 Jon Schlinkert
Released under the MIT license
***
_This file was generated by [verb](https://github.com/assemble/verb) on December 12, 2014. To update, run `npm i -g verb && verb`._