From 3d6136619804a215db7488756a7bea4f5ff56513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me> Date: Wed, 28 Jun 2023 22:00:46 +0200 Subject: [PATCH] Toolbox => Add urlToPath function --- Toolbox.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Toolbox.ts b/Toolbox.ts index efd35eb..02e52f8 100644 --- a/Toolbox.ts +++ b/Toolbox.ts @@ -16,6 +16,10 @@ class Toolbox { return str === 'true' || str === '1'; } + public urlToPath(url: string): string { + return url.replace(/^([a-z]{3,5}:\/{2})?[a-z.@]+(:[0-9]{1,5})?.(.*)/, '$3').replace('.git', ''); + } + public randomString(length: number) { let result = ''; let characters = 'abcdefghjklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789'; -- GitLab