notes and tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-05-18 12:24:31 +03:00
parent 6aea814138
commit 929d8246fe
2 changed files with 5 additions and 3 deletions

View File

@ -1639,7 +1639,7 @@ are yielded down the generator chain.
Equivalents to `Array`'s `.map(..)`, `.filter(..)` and `.reduce(..)` but return
generators that yield the handler return values.
Note that `.map(..)` here also supports a generator as a handler
`.map(..)` here also supports a generator as a handler
```javascript
var expand = function*(n){
yield* (new Array(n)).fill(n) }
@ -1647,8 +1647,8 @@ var expand = function*(n){
// will create: [1, 2, 2, 3, 3, 3]
var L = [1,2,3]
.iter()
.map(expand)
.toArray()
.map(expand)
.toArray()
```
<!--

View File

@ -239,6 +239,8 @@ object.Mixin('GeneratorProtoMixin', 'soft', {
// NOTE: if func is instanceof Generator then it's result (iterator)
// will be expanded...
// NOTE: there is no point to add generator-handler support to either
// .filter(..) or .reduce(..)
map: function*(func){
var i = 0
if(func instanceof Generator){