mirror of
https://github.com/flynx/types.js.git
synced 2025-12-19 09:51:40 +00:00
notes and tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
6aea814138
commit
929d8246fe
@ -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()
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
@ -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){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user