by staticassertion · 6y ago · 0 comments
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.
function isPromise(obj) {
return typeof obj?.then === 'function'
}