Code Adjustment

Code Adjustment

{
    ...
    listExistingZones.sort(zoneSortOrder());
    return listExistingZones;
}

function zoneSortOrder() {
    return function(a, b) {
        if (a.name > b.name) {
            return 1;    
        } else if (a.name < b.name) {
            return -1;
        }
        return 0;
    }
}
This commit is contained in:
Alezia Kurdis 2020-05-21 22:13:33 -04:00 committed by GitHub
parent 3023924cf1
commit e6d092aefe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2905,17 +2905,15 @@ function getExistingZoneList() {
};
listExistingZones.push(thisZone);
}
var zoneSortProperty = "name";
var zoneSortOrder = getSortOrder(zoneSortProperty);
listExistingZones.sort(zoneSortOrder);
listExistingZones.sort(zoneSortOrder());
return listExistingZones;
}
function getSortOrder(sortProperty) {
function zoneSortOrder() {
return function(a, b) {
if (a[sortProperty] > b[sortProperty]) {
if (a.name > b.name) {
return 1;
} else if (a[sortProperty] < b[sortProperty]) {
} else if (a.name < b.name) {
return -1;
}
return 0;