partition-into

    1.0.0 • Public • Published

    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

    Install

    npm i partition-into

    DownloadsWeekly Downloads

    2

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • icyflame