pi

partition-into

Partition an array into required sets of n numbers, and the remaining values

Showing:

Popularity

Downloads/wk

1

GitHub Stars

1

Maintenance

Last Commit

6yrs ago

Contributors

0

Package

Dependencies

0

Size (min+gzip)

0.3KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

partition-into

Partition an array into required sets of n numbers, and the remaining values

Build Status

js-semistandard-style

Install

$ npm install --save partition-into

Usage

var partitionInto = require('partition-into');

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

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

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

API

partitionInto(input_obj, num)

input_obj

Required
Type: Array

Input 1-dimensional array

num

Required
Type: integer
Default: undefined

Number of items per partition

License

MIT © Siddharth Kannan

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100