3 ms·
This will work for a standard Promise, which is great, but not for weirdo made up promises. It also was released, I think, in 2018. It's one thing if you own t
by staticassertion 6y ago
This will work for a standard Promise, which is great, but not for weirdo made up promises. It also was released, I think, in 2018.
It's one thing if you own the entire codebase, but if you're building a popular, multiple-years-old library/framework, you can't make the same assumptions.
- mikewhy 6y agoI'm only finding about it today TBH. Usually I go for what this library does: function isPromise(obj) { return typeof obj?.then === 'function' }