Recognize defaults in CoffeeScript code when object destructuring is used #434

Open
pbadenski opened this Issue Apr 22, 2016 · 0 comments

Projects

None yet

1 participant

@pbadenski

This is a correct CoffeScript code:

method = ({foo = 2}) -> console.log(foo)

but when used with js2cofee it reports an error: unexpected =

Coffeescript transpiler translates it to the equivalent JavaScript code:

(function() {
  var method;

  method = function(arg) {
    var foo, ref;
    foo = (ref = arg.foo) != null ? ref : 2;
    return console.log(foo);
  };

}).call(this);

I believe js2coffee should match the behavior of a coffeescript transpiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment