3.0.1 • Published 9 years ago
concat-iterable v3.0.1
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:
...iterablesare iterable objectssumis 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:
iterableis a finite iterable objectcountis an unsigned integer which represents number of times to iterate throughiterablerepeatis an finite iterable object but withcounttimes 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']