unsafe_where_true
unsafe_where_true

Reputation: 6300

how does this javascript "translate" to coffeescript?

JS:

func(a, 'b', function(e, obj) {
    //does some stuff
}.another_func(obj));

My Coffee:

func(a, 'b', (e, obj) ->
   #does some stuff
.another_func(obj)

but this doesn't seem to work.

Upvotes: 0

Views: 45

Answers (1)

Bergi
Bergi

Reputation: 664538

Wrap the function in explicit parenthesis:

func a, "b", ((e, obj) ->
    #does some stuff
).another_func obj

(or, with explicit method invocation):

func(a, "b", ((e, obj) ->
    #does some stuff
).another_func(obj))

Upvotes: 2

Related Questions