I’m attempting to compile the very simple coffee script:
n = 4;
Using the code
require('coffee-script').compile(str);
I do this multiple times in my solution, without caching the results. The first time I do this, I get:
(function() {
var n;
n = 4;
}).call(this);
but if I then call it again, I get:
n = 4;
Why don’t I get the wrapper function the second time round, and how can I make it give the same results every time.
Can’t reproduce, I get the same (wrapped) code everytime.
Use
coffee.compile(str, { bare: false })to enforce the closure wrapper.