MyConstructor = ->
this.args = arguments
this
obj = applyToNew MyConstructor, [1, 2, 3]
obj.args # [ 1, 2, 3 ]
Created
June 14, 2015 09:57
-
-
Save aleclarson/0ca7454bf4c865d79e82 to your computer and use it in GitHub Desktop.
applyToNew(constructor, args)
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
applyToNew = (c, args) -> | |
new ( c.bind.apply c, [c].concat args ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment