diff --git a/helpers/Toolbox.ts b/helpers/Toolbox.ts index 02e52f826f581331bf05d1a7a7755e9b9465b693..bea427efb408c596f4394c7ade36bce84eccc952 100644 --- a/helpers/Toolbox.ts +++ b/helpers/Toolbox.ts @@ -11,42 +11,9 @@ class Toolbox { return Toolbox._instance; } - public strToBool(str: string): boolean { - str = str.toLowerCase().trim(); - 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'; - let charactersLength = characters.length; - for ( let i = 0 ; i < length ; i++ ) { - result += characters.charAt(Math.floor(Math.random() * charactersLength)); - } - return result; - } - - public capitalizingFirstLetter(word: string): string { - return word.charAt(0).toUpperCase() + word.slice(1); - } - - public capitalizeName(name: string) { - return name.trim().replace(/(?:^|\s|-)\S/g, s => s.toUpperCase()); - } - - public formatHour(hour: string): string { - let hourElements = hour.split(':'); - - return hourElements[0] + 'h' + hourElements[1]; - } - - public async sleep(ms: number) { - await new Promise(r => setTimeout(r, ms)); - } }