1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-13 06:43:35 +00:00

move sort to service

This commit is contained in:
Kyle Spearrin
2017-08-30 08:35:34 -04:00
parent 7ce6634120
commit ae6c609c91
2 changed files with 20 additions and 32 deletions

View File

@@ -518,6 +518,25 @@ function initLoginService() {
return 0;
};
LoginService.prototype.sortLoginsByLastUsedThenName = function (a, b) {
var result = this.sortLoginsByLastUsed(a, b);
if (result !== 0) {
return result;
}
var nameA = (a.name + '_' + a.username).toUpperCase();
var nameB = (b.name + '_' + b.username).toUpperCase();
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
return 0;
};
function handleError(error, deferred) {
deferred.reject(error);
}