Closure compiler externs files for underscore and backbone js
As part of some other things I’m working on I’ve begun building upon some existing closure compiler externs files for the Underscore and Backbone js libraries. Both are still in quite early stages, but if you need something like this, they’re currently better than nothing.
backbone-js-externs on github, for Backbone 0.9.2
underscore-js-externs on github, for Underscore 1.3.3
The Backbone externs file is taken from this gist, which was autogenerated by DotNetWise’s externs extractor. It does a decent but very basic job.
The Underscore externs file is taken from the official Closure Compiler repository. The only changes I’ve made so far are
- fixing a type annotation for the _.uniq and _.unique functions that had a required parameter after a non-required one (Closure Compiler dislikes this)
- using same type annotation for _.uniq and _.unique, since the latter is an alias for the former
- beginning to add type annotations for functional-style usage of underscore, vs. object notation (e.g. _(collection).map(function(){}) vs. _.map(collection, function() {}). The existing externs file has only the latter.
I’ll probably also be adding externs for use with the SVG library Raphael at some point.