I debugged to understand why global.Promise is polyfilled even though node has native support for Promises. I found that Object.prototype.toString.call(P.resolve()) returns '[object Object]' and not '[object Promise]' like in Chrome.
Perhaps there is a broader and more elegant way to fix the issue, but with this patch the native Promise function is no longer overriden in node.
Thanks for your useful module. We use it in OpenPGP.js.
The polyfill detection seems to be broken at least under the current node LTS (v4.4.3). See: https://github.com/openpgpjs/openpgpjs/issues/455
I debugged to understand why
global.Promise
is polyfilled even though node has native support for Promises. I found thatObject.prototype.toString.call(P.resolve())
returns'[object Object]'
and not'[object Promise]'
like in Chrome.Perhaps there is a broader and more elegant way to fix the issue, but with this patch the native Promise function is no longer overriden in node.