News for hackers. Stuff that matters.
Re:Using the switch(true) pattern in JavaScript by throwanem on Monday April 12, 2021 @07:27PM (#26786412)
I don't know of an equivalent in the native API, but Bluebird's "disposer" implements this in the context of promises: http://bluebirdjs.com/docs/api/disposer.html

It would be nice if there were an equivalent in the native API. You can use .finally() with chained promises, but as far as I know there's nothing comparable with async/await yet, and that's a much more comfortable syntax with which to work with promises overall.

There are no comments on this comment yet.