Enabling mixins inclusion for all Javascript classes
Function::include = (mixins...) ->
for mixin in mixins
@::[k] = v for k,v of mixin.prototype when k isnt 'constructor'
Written by Cédric Néhémie
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Coffeescript
Authors
iam4x
94.17K
ericdfields
63.02K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#