Created
July 20, 2015 07:16
-
-
Save aitoraznar/6d6ad4356fb8933514cc to your computer and use it in GitHub Desktop.
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 sortByAttribute(gameList, sortAttributesList) { | |
if (!gameList) return; //Ensure we data data to sort | |
if (!sortAttributesList) return gameList; //Return same list if no sort attribute provided | |
sortAttributesList = typeof sortAttributesList === 'string' ? [sortAttributesList].slice() : sortAttributesList; | |
sortAttributesParams = getSortAttributesWithOrder(sortAttributesList); | |
return gameList.slice().sort(function (a, b) { | |
return sortByAttrStrategy(a, b, sortAttributesParams.slice()); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment