Sunday, 29 September 2013

Unexpected Coffeescript transformation with if?

Unexpected Coffeescript transformation with if?

This CoffeeScript:
x = y > z ? 'a' : 'b'
Compiles to:
x = (_ref = y > z) != null ? _ref : {
'a': 'b'
};
I assume this is expected, just not intuitive.
This there a better way to do this in coffeescript?

No comments:

Post a Comment