Created
November 22, 2015 23:55
-
-
Save eliot-akira/c979efb6cafcb5dafcb6 to your computer and use it in GitHub Desktop.
Mixin in CoffeeScript
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
mixOf = (base, mixins...) -> | |
class Mixed extends base | |
for mixin in mixins by -1 | |
for name, method of mixin:: | |
Mixed::[name] = method | |
Mixed | |
... | |
class A extends mixOf Foo, Bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment