combination-iterator

0.1.0 • Public • Published

combination-iterator Build Status codecov

Iterate by combination values in a list

Combination

Install

$ npm install combination-iterator

Usage

Array

const combinationIterator = require('combination-iterator');
 
const it = combinationIterator(['a', 'b', 'c']);
 
it.next(); // => { value: [ 'a', 'b' ], done: false }
it.next(); // => { value: [ 'a', 'c' ], done: false }
it.next(); // => { value: [ 'b', 'c' ], done: false }
it.next(); // => { value: undefined, done: true }

Object

const it = combinationIterator({
  1: 'a',
  2: 'b',
  3: 'c'
});
 
// Same bahavior as arrays
it.next(); // => { value: [ 'a', 'b' ], done: false }

License

MIT © Thibaut Vieux

/combination-iterator/

    Package Sidebar

    Install

    npm i combination-iterator

    Weekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    4.91 kB

    Total Files

    7

    Last publish

    Collaborators

    • melkir