3 ms·
I implemented this a while back, but have not yet cleaned it up nor turned it into a library: http://jsfiddle.net/bruth/p6SUF/ http://jsfiddle.net/bruth/p6SUF/
by bruth 14y ago
I implemented this a while back, but have not yet cleaned it up nor turned it into a library: http://jsfiddle.net/bruth/p6SUF/ http://jsfiddle.net/bruth/p6SUF/ Open up the console to see the output.
Here is slightly cleaner one that I plan to submit as a feature to Backbone. It assumes underscore.js is present: https://github.com/bruth/backbone/commit/a7f8bd3d9fa06a63cf429ab15519f80965d78208#L0R1491 https://github.com/bruth/backbone/commit/a7f8bd3d9fa06a63cf4... Here is a JSFiddle example: http://jsfiddle.net/bruth/pwpNw/ http://jsfiddle.net/bruth/pwpNw/ (Open up the console to see the output)
EDIT: Add JSFiddle example for second implementation