tweaks, docs and notes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-06-21 13:49:50 +03:00
parent a4d9a90f78
commit 3a211c9d82
3 changed files with 30 additions and 5 deletions

View File

@ -294,6 +294,8 @@ object.Constructor('IterablePromise', Promise, {
.then(function(){
return res }) },
// XXX .chain(..) -- see generator.chain(..)
flat: function(depth=1){
return this.constructor(this,
function(e){

View File

@ -124,6 +124,13 @@ Library of JavaScript type extensions, types and utilities.
- [Generator helpers](#generator-helpers)
- [`generator.stoppable(..)`](#generatorstoppable)
- [Async generator extensions](#async-generator-extensions)
- [`<async-generator>.then(..)` / `<async-generator>.catch(..)` / `<async-generator>.finally(..)`](#async-generatorthen--async-generatorcatch--async-generatorfinally)
- [`<async-generator>.iter(..)`](#async-generatoriter)
- [`<async-generator>.map(..)` / `<async-generator>.filter(..)` / `<async-generator>.reduce(..)`](#async-generatormap--async-generatorfilter--async-generatorreduce)
- [`<async-generator>.chain(..)`](#async-generatorchain)
- [`<async-generator>.flat(..)`](#async-generatorflat)
- [`<async-generator>.concat(..)`](#async-generatorconcat)
- [`<async-generator>.push(..)` / `<async-generator>.unshift(..)`](#async-generatorpush--async-generatorunshift)
- [Containers](#containers)
- [`containers.UniqueKeyMap()` (`Map`)](#containersuniquekeymap-map)
- [`<unique-key-map>.set(..)`](#unique-key-mapset)
@ -2486,6 +2493,20 @@ stoppable(<generator>)
XXX EXPERIMENTAL
#### `<async-generator>.then(..)` / `<async-generator>.catch(..)` / `<async-generator>.finally(..)`
#### `<async-generator>.iter(..)`
#### `<async-generator>.map(..)` / `<async-generator>.filter(..)` / `<async-generator>.reduce(..)`
#### `<async-generator>.chain(..)`
#### `<async-generator>.flat(..)`
#### `<async-generator>.concat(..)`
#### `<async-generator>.push(..)` / `<async-generator>.unshift(..)`
## Containers

View File

@ -484,11 +484,14 @@ object.Mixin('AsyncGeneratorProtoMixin', 'soft', {
for await(var elem of that){
res.push(elem) }
_resolve(res) })
resolve
&& p.then(resolve)
reject
&& p.catch(reject)
p = (resolve || reject) ?
p.then(...arguments)
: p
return p },
catch: function(func){
return this.then().catch(func) },
finally: function(){
return this.then().finally(func) },
// XXX might be a good idea to use this approach above...
iter: stoppable(async function*(handler=undefined){
@ -537,7 +540,6 @@ object.Mixin('AsyncGeneratorProtoMixin', 'soft', {
// XXX
// slice
// chain
// ...
})