Skip to content

Instantly share code, notes, and snippets.

@mlsteele
Created August 6, 2013 15:06
Show Gist options
  • Save mlsteele/6165311 to your computer and use it in GitHub Desktop.
Save mlsteele/6165311 to your computer and use it in GitHub Desktop.
# pre-apply this to an object's method definition to make it return the
# context and thus be chainable.
# example:
# class FOO
# addThing: make_chainable (e) -> @stuff.push e
make_chainable = (f) -> ->
f.apply this, arguments
this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment