Last active
August 29, 2015 14:17
-
-
Save jeneg/a3c77a4708ddb78f95ef to your computer and use it in GitHub Desktop.
Function for alphabetical sort of Angular dependency injections
This file contains hidden or 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 for alphabetical sort of Angular dependency injections | |
*/ | |
(function() { | |
var arr = ['$state', '$stateParams', '$rootScope', '$timeout', | |
'$templateCache', '$compile', 'googleMapService', | |
'actionCreateService', '$filter', 'configModel']; | |
arr.sort(function (a, b) { | |
a = a.replace('$', ''); | |
b = b.replace('$', ''); | |
if (a < b) { return -1; } | |
if (a > b) { return 1; } | |
return 0; | |
}); | |
console.log("'" + arr.join("', '") + "'"); | |
console.log(arr.join(', ')); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment