js2coffee
Version:
JavaScript to CoffeeScript compiler
27 lines (23 loc) • 582 B
Plain Text
notes: """
Named function declarations in JavaScript can appear at any point of the
scope, and they will be available anywhere in the scope. CoffeeScript doesn't
allow named function declarations, however.
To get around this, js2coffee takes function declarations and puts the on top
of the scope.
This is an improvement over js2coffee 0.x that only looks in the same level
of the function body, not recursing into deeper blocks.
"""
----
alert(name());
if (ok) {
a();
function name() {
return "John";
}
}
----
name = ->
'John'
alert name()
if ok
a()