coffeescript - Chain function call after function definition -


this question has answer here:

how can chain function call after function definition in coffeescript?

equivalent javascript be:

var foo = function () {     // stuff }.bar() 

the way managed is:

foo = `function () {     // stuff }.bar()` 

but hope better solution embedding javascript in (beautiful) coffeescript code

try this:

foo = (-> stuff).bar() 

for example:

square = ((x)-> x*x).bar() 

compiles into:

var square; square = (function(x) {   return x * x; }).bar(); 

Comments