Hello,
If it’s not too awkward of a question to ask: were object methods
rather than string comparison considered for Promise.allSettled()?
For example, if I write this:
-----
Promise.allSettled(promises).then( results => {
results.forEach( r => {
if (r.status === "rejectd") {
// Failure …
}
else {
// Success!
}
} );
} );
-----
… the code won’t complain about the typo but instead just “do the wrong thing”.
But, if the way to parse allSettled()’s resolution were object methods instead,
it could be this:
-----
Promise.allSettled(promises).then( results => {
results.forEach( r => {
if (r.isRejectd()) {
// Failure …
}
else {
// Success!
}
} );
} );
-----
… which will usefully cause an exception/rejection that pinpoints the problem
in my code.
Was this pattern perhaps considered and rejected? Or is there some
liability to the object methods relative to the string comparison that I’m not
seeing? If so, what was/is the rationale there?
Thank you for your time!
cheers,
-Felipe Gasper
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss