Skip to content

Instantly share code, notes, and snippets.

@vangie
Last active December 11, 2015 16:58
Show Gist options
  • Save vangie/4630840 to your computer and use it in GitHub Desktop.
Save vangie/4630840 to your computer and use it in GitHub Desktop.
coffeescript define function in loop
val = (x, ctx, args) =>
if _.isFunction x
x.apply ctx or this, args or []
else
x
[
openWith
replaceWith
closeWith
repaceHolder
openBlockWith
closeBlockWith
] = ((do(x)=>=>val @model.get(x),@model) for x in [
"openWith"
"replaceWith"
"closeWith"
"repaceHolder"
"openBlockWith"
"closeBlockWith"
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment