Backbone.js and Underscore.js Extensions / Plugins

Submitted by tomo on December 17, 2012 - 3:31pm

As I blogged recently, Drupal 8 core now has two new JavaScript libraries: Underscore.js and Backbone.js. But, like jQuery, these libraries or frameworks can also be extended with JavaScript modules that integrate or are based on them.

Backbone has a lot of projects based on it, whereas Underscore has relatively few, besides Backbone itself.

The main Backbone page lists a lot of Backbone resources: https://github.com/documentcloud/backbone/wiki/Extensions,-Plugins,-Resources

But here are some others:

http://kmalakoff.github.com/knockback/ - Knockback.js brings Knockout.js magic to Backbone.js

https://github.com/lukasolson/Backbone-Super - A convenient super method for the popular JavaScript library, Backbone.js.

http://chaijs.com/plugins/chai-backbone - Chai Assertion Library extends itself for Backbone support: chai-backbone is an extension to the chai assertion library that provides a set of backbone specific assertions.

Underscore plugins

Really, not nearly as much directly based on Underscore.js as on Backbone. But here are a few:

underscore-awesomer.js

https://github.com/kmalakoff/underscore-awesomer - By the author of Knockback, underscore-awesomer.js purports to add even awesomer features to Underscore.js! For example:

Keypaths to reference deeply into nested objects:

_.keypath({hello: {world:!} }, ‘hello.world); // returns ‘!’

Array or object _.remove:

var removed = _.remove({bob: 1, fred: 3, george: 5}, [‘bob’, ‘george’]); _.isEqual(removed, [1,5]);

And some other stuff, including stuff that's already been moved into separate independent libraries!

Underscore.string

Underscore.string adds various string manipulation operations like you'd find in Python like capitalization, whitespace removal, searching, and lots more. Actually, Underscore.js isn't a dependency but with _ you get to do chaining.

Link: https://github.com/epeli/underscore.string

Singool.js

Lightweight JavaScript framework for developing single-page web applications.

Singool already uses Underscore.js since that is a dependency for using Backbone.js. So it uses its templating system by default.

Link: http://fahad19.github.com/singool/

Happy.js

"Lightweight, extensible form validation plugin for jQuery/Zepto.js, HTML5, and Underscore.js" - Well, honestly the only Underscore.js integration is has is to allow you to call _.mixin on your own validation functions.

http://thechangelog.com/post/3028809528/happy-js-form-ishappy-lightweight-extensible-form-valida

Underscore alternatives

http://lodash.com/ - An alternative to Underscore.js, delivering consistency, customization, performance, and extra features.
http://sugarjs.com/ - Sugar is a Javascript library that extends native objects with helpful methods. It is designed to be intuitive, unobtrusive, and let you do more with less code. "Underscore with Prototype-ish syntax."

© 2010-2014 Saigonist.