medikoo / es5-ext

ECMAScript extensions (with respect to upcoming ECMAScript features)
ISC License
168 stars 81 forks source link

Introduce (is|ensure)Thenable, update isPromise #76

Closed medikoo closed 5 years ago

medikoo commented 6 years ago

isThenable should detect objects that expose then method.

isPromise should be updated to detect thenables of which constructor creates new promises up to constructor revealing pattern. Still check should not try to create a promise, instead just checking for existence of constructor.resolve and constructor.reject should be fine

medikoo commented 5 years ago

Those utils are now served elegantly by type package, with small difference that promise/is confirms on native promise or it's extension.