1.0.1 • Published 9 years ago

partition-all v1.0.1

Weekly downloads
10
License
MIT
Repository
-
Last release
9 years ago

partition-all

Build Status npm version

Returns a sequence of arrays, but may include partitions with fewer than n items at the end.

Installation

npm install partition-all --save

Usage

var partitionAll = require('partition-all');

partitionAll(2, [1, 2, 3, 4, 5, 6]); // => [[1, 2], [3, 4], [5, 6]]
partitionAll(2, [1, 2, 3, 4, 5]); // => [[1, 2], [3, 4], [5]]
partitionAll(3, [1, 2, 3, 4, 5]); // => [[1, 2, 3], [4, 5]]

var partition2 = partitionAll(2);

partition2([1, 2, 3, 4, 5, 6]); // => [[1, 2], [3, 4], [5, 6]]