mirror of
https://github.com/flynx/types.js.git
synced 2025-12-19 01:41:38 +00:00
tweaks, docs and notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
a4d9a90f78
commit
3a211c9d82
@ -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){
|
||||
|
||||
21
README.md
21
README.md
@ -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
|
||||
|
||||
12
generator.js
12
generator.js
@ -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
|
||||
// ...
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user