Replace another use of toSorted

5e24ae4db2c0a1aff552193e8f5c7ee8d9f74941

Tucker McKnight <tucker@pangolin.lan> | Sun Feb 01 2026

Replace another use of toSorted
js_templates/common/branchesListItems.ts:4
Before
3
4
5
6
7
8
  currentBranch: string,
  sortBy: 'name' | 'date',
): string => {
  return branches.toSorted((a, b) => {
    let comparison = 0
    if (a[sortBy] < b[sortBy]) { comparison = -1 }
    if (a[sortBy] > b[sortBy]) { comparison = 1 }
After
3
4
5
6
7
8
  currentBranch: string,
  sortBy: 'name' | 'date',
): string => {
  return branches.sort((a, b) => {
    let comparison = 0
    if (a[sortBy] < b[sortBy]) { comparison = -1 }
    if (a[sortBy] > b[sortBy]) { comparison = 1 }
main.ts:202
Before
201
202
203
204
205
206
      return {name: file.replace(currentLevel, ''), fullPath: file, isDirectory}
    })

    const sortedByDirectory = withNameAndDirAttrs.filter(onlyUnique).toSorted((a, b) => {
      if (a.isDirectory && b.isDirectory) {
        return 0
      }
After
201
202
203
204
205
206
      return {name: file.replace(currentLevel, ''), fullPath: file, isDirectory}
    })

    const sortedByDirectory = withNameAndDirAttrs.filter(onlyUnique).sort((a, b) => {
      if (a.isDirectory && b.isDirectory) {
        return 0
      }