concat-iterable
v3.0.1
Published
Traverse every elements of several iterables sequentially or one iterable repeatedly
Downloads
24
Maintainers
Readme
concat-iterable
Requirements
- Node >= 6.0.0
Features
Traverse every elements of several iterables sequentially
Traverse one iterable repeatedly
Usage
Import
var ConcatIterable = require('concat-iterable');
Constructor
Traverse every elements of several iterables sequentially
Form
var concat = new ConcatIterable(...iterables);
Where:
...iterables
are iterable objectssum
is an iterable object (which may be finite or even endless)
Example
var alphabet = new ConcatIterable('abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz');
console.log([...alphabet]);
You would seen an array of alphabet
Function: ::multiply
a.k.a ::times
Traverse one iterable repeatedly
Form
repeat = ConcatIterable.multiply(iterable, count);
Where:
iterable
is a finite iterable objectcount
is an unsigned integer which represents number of times to iterate throughiterable
repeat
is an finite iterable object but withcount
times longer thaniterable
Example
var tribledabc = ConcatIterable.multiply('abc', 3);
console.log([...tribledabc]);
Similar to new ConcatIterable('abc', 'abc', 'abc')
- i.e. 'abcabcabc'
, you would seen ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c']