wrong conversion of IIFE syntax
jpillora opened this issue · comments
Jaime Pillora commented
window.foo = (function() {
return 42;
}());
converts to:
window.foo = (->
42
())
end braces should be: )()
Anton W commented
from #150
other syntax, but also broken:
foo = function(){
thing();
}();
gets compiled to
foo = ->
thing()
()
when it should be
foo = (->
thing()
)()
Anton W commented
Workaround
Use this syntax and you're safe in js2coffee
// jQuery syntax: (outies)
(function (w,d) {
// your code here
})(window, document);
Rico Sta. Cruz commented
Jaime Pillora commented
nice work with the new version, what's the purpose of the "preview" window? did people not like the two-way conversion?
Rico Sta. Cruz commented
mostly i felt it was ambiguous—you weren't sure if you were in js->coffee mode or coffee->js mode. moreso, i dont want to encourage the behavior of getting CoffeeScript output and passing it back to js2coffee :)