Tucker McKnight <tmcknight@instructure.com> | Sat Jun 20 2026
DRY the branchesWithHrefs object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
currentRefType: data.currentRefType,
})
const branchesWithHrefs = {
branches: repo.branches.map((branch) => {
return {
name: branch.name,
href: nav.refHome({refName: branch.name, refType: 'branch'}) + '/' + data.nav.path,
date: repo.commits.get(branch.sha).date.toISOString(),
}
}),
tags: (repo.tags.map((tag) => {
return {
name: tag.name,
href: nav.refHome({refName: tag.name, refType: 'tag'}) + '/' + data.nav.path,
date: repo.commits.get(tag.sha).date.toISOString(),
}
}))
}
return {21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
currentRefType: data.currentRefType,
})
const refObject = (ref, refType: 'branch' | 'tag') => {
return {
name: ref.name,
href: nav.refHome({refName: ref.name, refType}) + '/' + data.nav.path,
date: repo.commits.get(ref.sha).date.toISOString(),
}
}
const branchesWithHrefs = {
branches: repo.branches.map(branch => refObject(branch, 'branch')),
tags: repo.tags.map(tag => refObject(tag, 'tag')),
}
return {