Tucker McKnight <tucker@pangolin.lan> | Sun Feb 01 2026
Replace another use of toSorted
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 }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 }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
}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
}