/powerset-stream

Streams all the possible combinations of subsets of the set given in input

Primary LanguageJavaScriptMIT LicenseMIT

powerset-stream

A readable stream that generates all the possible combinations of subsets of the set given in input.

NPM version Build Status Downloads

Install

Node.js

npm install powerset-stream

Usage

powersetStream([1, 2, 3])
  .on('data', function(comb) {
    console.log(comb);
  });

/* Prints:

[ 1 ]
[ 2 ]
[ 3 ]
[ 1, 2 ]
[ 1, 3 ]
[ 2, 3 ]
[ 1, 2, 3 ]

*/

Credits