YUI.module = function(o, f) {
var name = o.name,
ver = o.version;
delete o.name;
delete o.version;
if(!name || !version) throw "Both `name` and `version` are required.";
return YUI.add(name, f, ver, o);
}
YUI.module
name: 'myCoolModule'
version: 1.0
requires: ['app','model']
(Y) -> ...
Ultimately CoffeeScript is syntax sugar for Javascript that you pay for with wrong line numbers when debugging. I think it's worth it, but I have friends who disagree. My coffeescript source is about 30% fewer lines of code than the equivalent javascript. Roughly half of that is entirely closing braces/parens but the other half is actual code reduction/simplification, mostly from loop comprehensions.I also use it for API design. My habit when doing the design is to write out code for how I'd like to use it. I always use coffeescript for this regardless of whether I'm implementing it in JS or CS because a bad api visually looks bad to me when I write it out and I bang at it until it looks right. I've been mocked for this process by a couple people who have asked for my input on their projects but I've never had someone not take my resulting recommendations.