1.0.0 • Published 8 years ago

a-split v1.0.0

Weekly downloads
9
License
MIT
Repository
github
Last release
8 years ago

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