0.1.0 • Published 6 years ago
combination-iterator v0.1.0
combination-iterator
Iterate by combination values in a list
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
0.1.0
6 years ago