Wondering what’s next for npm?Check out our public roadmap! »

split-array

1.0.1 • Public • Published

split-array Build Status

Split an array into arrays of a specific length

Install

$ npm install --save split-array

Usage

var splitArray = require('split-array');
 
splitArray(['a', 'b', 'c', 'd', 'e', 'f'], 2);
//=> [['a', 'b'], ['c', 'd'], ['e', 'f']]
 
splitArray(['a', 'b', 'c', 'd', 'e', 'f', 'foo'], 3);
//=> [['a', 'b', 'c'], ['d', 'e', 'f'], ['foo']]

API

splitArray(array, maxLength)

array

Required
Type: array

The array to split up.

maxLength

Required
Type: number

The maximum amount of items a partial can have

License

MIT © Arthur Verschaeve

Install

npm i split-array

DownloadsWeekly Downloads

1,587

Version

1.0.1

License

MIT

Last publish

Collaborators

  • avatar