Created
November 14, 2011 01:00
-
-
Save searls/1362999 to your computer and use it in GitHub Desktop.
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
#looking for some code that won't work? you're in luck! | |
window.newb = (Constructor) -> | |
args = Array.prototype.slice.call(arguments, 1) | |
return -> | |
Temp = -> | |
Temp.prototype = Constructor.prototype | |
inst = new Temp | |
ret = Constructor.apply(inst, args) | |
return Object(ret) == ret ? ret : inst |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment