Tucker McKnight
Fix sorting bug on branch dropdowns Sort order wasn't being respected when tying in the search box. Also make it sort by date in reverse order -- that is, newest (largest date number) on top.
107
dropdownBranchesResults.innerHTML = branchesListItems(branches, window.defaultBranch, window.currentBranch)
107
dropdownBranchesResults.innerHTML = branchesListItems(branches, window.defaultBranch, window.currentBranch, sortDirection)
5 6 7
if (a[sortBy] < b[sortBy]) { return -1 }
if (a[sortBy] > b[sortBy]) { return 1 }
return 0
5 6 7
let comparison = 0
if (a[sortBy] < b[sortBy]) { comparison = -1 }
if (a[sortBy] > b[sortBy]) { comparison = 1 }
// we want reverse order if sorting by date (making newest first)
if (sortBy === 'date') { comparison = comparison * -1 }
return comparison