From 37f97f5981472a61626f202585fcf6d7ffb935e4 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 24 Dec 2022 23:03:22 +0300 Subject: [PATCH] experimenting... Signed-off-by: Alex A. Naanou --- Promise.js | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Promise.js b/Promise.js index 41c4b85..e9204d3 100644 --- a/Promise.js +++ b/Promise.js @@ -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 (???)