ig-types 6.24.8 → 6.24.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Promise.js +7 -14
- package/generator.js +4 -2
- package/package.json +1 -1
package/Promise.js
CHANGED
|
@@ -133,25 +133,18 @@ object.Constructor('IterablePromise', Promise, {
|
|
|
133
133
|
if(!onerror){
|
|
134
134
|
list = [...list]
|
|
135
135
|
// handle errors in input generator...
|
|
136
|
+
// NOTE: this does not offer the most control because semantically
|
|
137
|
+
// we bust behave in the same manner as <generator>.iter(..)
|
|
136
138
|
} else {
|
|
137
139
|
var res = []
|
|
138
140
|
try{
|
|
139
141
|
for(var e of list){
|
|
140
142
|
res.push(e) }
|
|
141
|
-
list = res
|
|
142
143
|
}catch(err){
|
|
143
144
|
var r = onerror(err)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
&& res.push(r.value)
|
|
148
|
-
list = res
|
|
149
|
-
} else {
|
|
150
|
-
list = r instanceof Array ?
|
|
151
|
-
r
|
|
152
|
-
: r ?
|
|
153
|
-
[r]
|
|
154
|
-
: [] } } } }
|
|
145
|
+
r !== undefined
|
|
146
|
+
&& res.push(r) }
|
|
147
|
+
list = res } }
|
|
155
148
|
// handle iterable promise...
|
|
156
149
|
if(list instanceof IterablePromise){
|
|
157
150
|
return this.__handle(list.__packed, handler, onerror) }
|
|
@@ -162,8 +155,8 @@ object.Constructor('IterablePromise', Promise, {
|
|
|
162
155
|
return list
|
|
163
156
|
.iter(handler, onerror)
|
|
164
157
|
.then(function(list){
|
|
165
|
-
return that.__pack(list) })
|
|
166
|
-
|
|
158
|
+
return that.__pack(list) }) }
|
|
159
|
+
if(list instanceof Promise){
|
|
167
160
|
return list
|
|
168
161
|
.then(function(list){
|
|
169
162
|
return that.__pack(list, handler, onerror) }) }
|
package/generator.js
CHANGED
|
@@ -583,8 +583,10 @@ object.Mixin('AsyncGeneratorProtoMixin', 'soft', {
|
|
|
583
583
|
if(onerror){
|
|
584
584
|
if(!(err === STOP || err instanceof STOP)){
|
|
585
585
|
var res = onerror(err)
|
|
586
|
-
if(res){
|
|
587
|
-
yield
|
|
586
|
+
if(res !== undefined){
|
|
587
|
+
yield handler ?
|
|
588
|
+
handler(res)
|
|
589
|
+
: res }
|
|
588
590
|
return } }
|
|
589
591
|
throw err } }),
|
|
590
592
|
|