Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iaindooley/8825831f8260080b20db23f94bd56767 to your computer and use it in GitHub Desktop.
Save iaindooley/8825831f8260080b20db23f94bd56767 to your computer and use it in GitHub Desktop.
Sort list by label alphabetically
function sortListByLabelAlphabetically(notification)
{
var added = new Notification(notification).addedCard();
added.list().sort(function(card1,card2)
{
var ret = 0;
try
{
if(card1.labels().first().name().toLowerCase() > card2.labels().first().name().toLowerCase())
ret = 1;
else if(card1.labels().first().name().toLowerCase() < card2.labels().first()name().toLowerCase())
ret = -1;
}
catch(e)
{
Notification.expectException(InvalidDataException,e);
}
return ret;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment