[go: up one dir, main page]

array-initial
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/array-initial package

1.1.0 • Public • Published

array-initial NPM version

Get all but the last element or last n elements of an array.

Install with npm

npm i array-initial --save

Usage

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

License

Copyright (c) 2014 Jon Schlinkert
Released under the MIT license


This file was generated by verb on December 12, 2014. To update, run npm i -g verb && verb.

Package Sidebar

Install

npm i array-initial

Weekly Downloads

1,109,464

Version

1.1.0

License

MIT

Last publish

Collaborators

  • phated
  • doowb
  • jonschlinkert