-
-
Save DavidBruant/1400408 to your computer and use it in GitHub Desktop.
an attempt to make the new operator dynamically invokeable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Requires a native Function.prototype.bind (IE9+, FF4+, Chrome, Opera 12, no Safari) | |
function newOperator(constructor, args) { | |
var params = [undefined].concat(args) | |
var cst = Function.prototype.bind.apply(constructor, params); | |
return new cst(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It should be