Negligible Psychological Misery
    Have ideas to improve npm?Join in the discussion! »

    array-sets

    1.0.3 • Public • Published

    To find all the combinations of an array

    install the package by using below command

    npm install array-sets
    You can use it like
    const combinations = require(‘array-sets’);
    let array_sets = combinations([1,2,3]);
    combinations function will return all the possible combinations of input array in an array
    [ 1, 2, 3, [ 1, 1 ], [ 1, 2 ], [ 1, 3 ], [ 2, 1 ], [ 2, 2 ], [ 2, 3 ], [ 3, 1 ], [ 3, 2 ], [ 3, 3 ], [ 1, 1, 1 ], [ 1, 1, 2 ], [ 1, 1, 3 ], [ 1, 2, 1 ], [ 1, 2, 2 ], [ 1, 2, 3 ], [ 1, 3, 1 ], [ 1, 3, 2 ], [ 1, 3, 3 ], [ 2, 1, 1 ], [ 2, 1, 2 ], [ 2, 1, 3 ], [ 2, 2, 1 ], [ 2, 2, 2 ], [ 2, 2, 3 ], [ 2, 3, 1 ], [ 2, 3, 2 ], [ 2, 3, 3 ], [ 3, 1, 1 ], [ 3, 1, 2 ], [ 3, 1, 3 ], [ 3, 2, 1 ], [ 3, 2, 2 ], [ 3, 2, 3 ], [ 3, 3, 1 ], [ 3, 3, 2 ], [ 3, 3, 3 ] ]

    Install

    npm i array-sets

    DownloadsWeekly Downloads

    0

    Version

    1.0.3

    License

    ISC

    Unpacked Size

    2.19 kB

    Total Files

    3

    Last publish

    Collaborators

    • avatar