Created
April 9, 2020 03:10
-
-
Save iaindooley/8825831f8260080b20db23f94bd56767 to your computer and use it in GitHub Desktop.
Sort list by label alphabetically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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