Functions that were polyfilled with core-js
(for example, babel-polyfill
) appear as native.
Promise.race.toString()
produces:
function race() {
[native code]
}
So does Object.values.toString()
.
While they are certainly not browser's native implementations. The example is Babel REPL page.
How can a developer programmatically check that a function is not native implementation but a polyfill that mimics native function (for instance, when it is known that a particular polyfill may cause problems in the application)?
Usually native code
regexp helps, but it is certainly not the case.
How can source code be retrieved from such functions? I'm primarily interested in Node.js but cross-platform solution is welcome.
How exactly was this trick done? I cannot find nothing for native code
search in core-js
and babel-polyfill
source code.