mirror of
https://github.com/flynx/types.js.git
synced 2025-10-29 02:20:07 +00:00
...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
61d9e121cb
commit
0a7ea0a423
33
Promise.js
33
Promise.js
@ -336,7 +336,38 @@ object.Constructor('IterablePromise', Promise, {
|
||||
return list
|
||||
[map](function(elem){
|
||||
// XXX migrate code from old .__pack(..)...
|
||||
// XXX
|
||||
/*/ XXX
|
||||
return elem instanceof IterablePromise ?
|
||||
(elem.isSync() ?
|
||||
handler(elem.sync())
|
||||
// XXX need to handle this but keep it IterablePromise...
|
||||
: elem.iterthen(handler))
|
||||
: (elem instanceof SyncPromise
|
||||
&& !(elem.sync() instanceof Promise)) ?
|
||||
handler(elem.sync())
|
||||
: elem && elem.then ?
|
||||
(handleSTOP ?
|
||||
// stoppable -- need to handle stop async...
|
||||
elem
|
||||
.then(function(res){
|
||||
return !stop ?
|
||||
handler(res)
|
||||
: [] })
|
||||
// NOTE: we are using .catch(..) here
|
||||
// instead of directly passing the
|
||||
// error handler to be able to catch
|
||||
// the STOP from the handler...
|
||||
.catch(handleSTOP)
|
||||
// non-stoppable...
|
||||
: elem.then(handler))
|
||||
: elem instanceof Array ?
|
||||
handler(elem)
|
||||
// NOTE: we keep things that do not need protecting
|
||||
// from .flat() as-is...
|
||||
: !handle ?
|
||||
elem
|
||||
: handler(elem)
|
||||
//*/
|
||||
elem = elem instanceof Array
|
||||
|| elem instanceof Promise ?
|
||||
that.__handle(elem, handler, onerror)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user