feat: Support for the "render" tag #163

This commit is contained in:
Jun Yang
2019-10-27 00:06:16 +08:00
parent b82fa9ed2b
commit d5e7b047bb
7 changed files with 269 additions and 10 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ function isCustomIterable (val: any): val is IterableIterator<any> {
return val && isFunction(val.next) && isFunction(val.throw) && isFunction(val.return)
}
export function toThenable (val: IterableIterator<any> | Thenable): Thenable {
export function toThenable (val: IterableIterator<any> | Thenable | any): Thenable {
if (isThenable(val)) return val
if (isCustomIterable(val)) return reduce()
return mkResolve(val)
@@ -61,7 +61,7 @@ export function toThenable (val: IterableIterator<any> | Thenable): Thenable {
}
}
export function toValue (val: IterableIterator<any> | Thenable) {
export function toValue (val: IterableIterator<any> | Thenable | any) {
let ret: any
toThenable(val)
.then((x: any) => {