File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,12 +15,35 @@ title: Iterable Utilities
1515
1616Makes an ` Iterable ` from a provided function. It could be a generator or a factory, but must return a new ` Iterator ` every time.
1717
18+ ``` js
19+ const iterable = createIterable (function * () {
20+ while (true ) yield Math .random ();
21+ });
22+
23+ const [x , y ] = iterable;
24+ const [z ] = iterable;
25+
26+ // x === 0.6486486024235587
27+ // y === 0.3952175724953333
28+ // z === 0.8863071830215743
29+ ```
30+
1831### getIterator
1932
2033` getIterator(iterable) => Iterator `
2134
2235Calls the ` Symbol.iterator ` method of the ` iterable ` for you.
2336
37+ ``` js
38+ const iterator = getIterator (` undercut` );
39+
40+ // Iterator {}
41+
42+ iterator .next ();
43+
44+ // {value: "u", done: false}
45+ ```
46+
2447### getRecursiveMapper
2548
2649` getRecursiveMapper(predicate, mapper) => Mapper `
You can’t perform that action at this time.
0 commit comments