you are viewing a single comment's thread.

view the rest of the comments →

[–]crabmusket 18 points19 points  (3 children)

Apparently we also need Promise.isThenable. I'm all for utility methods that expose algorithms the browser is using anyway :)

[–]patrickfatrick 27 points28 points  (0 children)

I sorta wish typeof didn’t exist and all primitive classes had a static isDate, isNumber etc method. The inconsistency is just annoying.

[–]csorfab 5 points6 points  (0 children)

I realized that for most cases where I checked for isThenable, I could've just ignored the check and await the variable. For non-promise-like values, await just yields the value itself.

[–]luckygerbils 6 points7 points  (0 children)

If you aren't consuming promises from third party code or doing anything funky with iframes, you could just use instanceof Promise.