borgwarehouse/helpers/functions/repositoryNameCheck.ts
Ravinou 4de1884de8
!breaking: 💣 repositoryName is now used instead of id #343
For every repository actions, to be idempotent
2025-04-20 23:08:36 +02:00

9 lines
302 B
TypeScript

// BorgWarehouse repository name is an 8-character hexadecimal string
export default function repositoryNameCheck(name: unknown): boolean {
if (typeof name !== 'string') {
return false;
}
const repositoryNameRegex = /^[a-f0-9]{8}$/;
return repositoryNameRegex.test(name) ? true : false;
}