experimenting...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-12-24 23:03:22 +03:00
parent 0a7ea0a423
commit 37f97f5981

View File

@ -335,8 +335,7 @@ object.Constructor('IterablePromise', Promise, {
: 'map'
return list
[map](function(elem){
// XXX migrate code from old .__pack(..)...
/*/ XXX
//* XXX migrate code from old .__pack(..)...
return elem instanceof IterablePromise ?
(elem.isSync() ?
handler(elem.sync())
@ -345,29 +344,29 @@ object.Constructor('IterablePromise', Promise, {
: (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 && 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)
//*/
//: !handle ?
// elem
: handler(elem) })
/*/
elem = elem instanceof Array
|| elem instanceof Promise ?
that.__handle(elem, handler, onerror)
@ -377,6 +376,7 @@ object.Constructor('IterablePromise', Promise, {
return e })
: elem
return elem })
//*/
.flat() },
//*/
// XXX this should return IterablePromise if .__packed is partially sync (???)