a-split

1.0.0 • Public • Published

a-split

Split an array into arrays of a specific length

Install

$ npm install --save a-split

Example

var split = require('a-split');
 
console.log(split([1, 2, 3, 4, 5, 6], 2));
 
// -> [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
 
console.log(split([1, 2, 3, 4, 5, 6, 7], 2));
 
// -> [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7 ] ]

require('a-split')(list, length)

Arguments:

  • list: The array to split up
  • length: The maximum amount of items a partial can have

Returns: Returns an array into arrays of a specific length

License

© 2016 Vikram Jadhav. MIT License

Package Sidebar

Install

npm i a-split

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • vikramcse