fix: Space in repo names

This commit is contained in:
Andras Bacsai
2022-03-31 15:11:51 +02:00
parent f4ba60cf8f
commit 17d56aa972
5 changed files with 28 additions and 19 deletions

View File

@@ -27,3 +27,13 @@ export function getDomain(domain) {
export function generateRemoteEngine(destination) {
return `ssh://${destination.user}@${destination.ipAddress}:${destination.port}`;
}
export function dashify(str: string, options?: any): string {
if (typeof str !== 'string') return str;
return str
.trim()
.replace(/\W/g, (m) => (/[À-ž]/.test(m) ? m : '-'))
.replace(/^-+|-+$/g, '')
.replace(/-{2,}/g, (m) => (options && options.condense ? '-' : m))
.toLowerCase();
}