spread-iterable
Requirements
- Node >= 6.0.0
Features
- Traverse grandchildren of iterable-iterables
Usage
Import
var SpreadIterable = ;
Constructor
Traverse grandchildren of iterable-iterables
Form
var grandchildren = grandparent;
Where:
-
grandparent
is an iterable object whose elements are iterable as well as their parent -
grandchildren
is an iterable object which iterates the 'elements' above
Example
var strings = 'abc' 'def' 'ghi';var letters = strings;console;
You would seen an array of letters from 'a'
to 'i'
::deep
a.k.a ::times
Function: Iterate even deeper
Form
var individuals = SpreadIterable;
Where:
-
groups
is an iterable -
level
is an unsigned integer -
individuals
is an iterable
Works:
-
If
level
is 0, iterategroups
itself -
If
level
is a positive integer, iteratenew DeepIterable(DeepIterable.deep(groups, level - 1))
-
If
level
is a negative number, function::deep
would throws an error
Example
var groups = 'abc' 'def' 'ghi' 'jkl' 'mno';var individuals = SpreadIterable;console;
Just like new SpreadIterable(new SpreadIterable(groups))
, you would seen an array of alphabet letters from 'a'
to 'o'