I love coffescript's null soakage ?
operator, but I recently started using Backbone.Model
's @has
(http://backbonejs.org/#Model-has, http://backbonejs.org/docs/backbone.html#section-37) when determining if an attribute is set. The JavaScript result is much more DRY since it uses a single Backbone method instead of duplicating the logic, you also save a var
...
@get('attachments')?.length > 0
becomes
var _ref;
((_ref = this.get('attachments')) != null ? _ref.length : void 0) > 0;