Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
_.sortByName() #underscore #mixin #cc
_.mixin({
// - Sort a list alphabetically
sortByName : function(a, b) {
var x = a.name.toLowerCase();
var y = b.name.toLowerCase();
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.