You cannot transfer the first two cases:
var x = function x(i) { return i + 1; }; function z(i) { return i + 1; }
In the latter case, you can check if it complains to the class when you call it:
function isClass(instance){ try{ instance() }catch(e){ return e.message === "Cannot call a class as a function"; } return false; }
But this, obviously, will cause side effects of its call, so in the general case this will not work.
Kit sunde
source share