summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/repository/utils/title.js
blob: 4e194640e92311617f2d8110d6b2c16c45d54f88 (plain)
1
2
3
4
5
6
7
8
9
// eslint-disable-next-line import/prefer-default-export
export const setTitle = (pathMatch, ref, project) => {
  if (!pathMatch) return;

  const path = pathMatch.replace(/^\//, '');
  const isEmpty = path === '';

  document.title = `${isEmpty ? 'Files' : path} · ${ref} · ${project}`;
};