When I run the following Coffeescript code:
@sum = (x, y) -> x + y
I get this compiled Javascript:
(function() {
this.sum = function(x, y) {
return x + y;
};
}).call(this);
Is there a way in Coffeescript to replace this in .call(this) with an arbitrary object like myObjector anything?
(function() {and}).call(this);are not the result of compiling@sum = ..., but added by thecoffeeexecutable. This is the actual result from compiling:To get a different/desired output, run
coffee -b -c(orcoffee -bcorcoffee --bare --compile) using the following code:becomes