From 52b8992cbf960e001336d59b83c610845ff35860 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Sun, 18 Feb 2024 23:56:40 +0100 Subject: infra(unicorn): prefer-string-replace-all (#2653) --- src/modules/internet/index.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/modules/internet') diff --git a/src/modules/internet/index.ts b/src/modules/internet/index.ts index 94851a53..86b03098 100644 --- a/src/modules/internet/index.ts +++ b/src/modules/internet/index.ts @@ -276,7 +276,7 @@ export class InternetModule extends ModuleBase { let localPart: string = this.userName({ firstName, lastName }); // Strip any special characters from the local part of the email address // This could happen if invalid chars are passed in manually in the firstName/lastName - localPart = localPart.replace(/[^A-Za-z0-9._+-]+/g, ''); + localPart = localPart.replaceAll(/[^A-Za-z0-9._+-]+/g, ''); // The local part of an email address is limited to 64 chars per RFC 3696 // We limit to 50 chars to be more realistic @@ -291,7 +291,7 @@ export class InternetModule extends ModuleBase { } // local parts may not contain two or more consecutive . characters - localPart = localPart.replace(/\.{2,}/g, '.'); + localPart = localPart.replaceAll(/\.{2,}/g, '.'); // local parts may not start with or end with a . character localPart = localPart.replace(/^\./, ''); @@ -661,7 +661,7 @@ export class InternetModule extends ModuleBase { // First remove simple accents etc result = result .normalize('NFKD') //for example è decomposes to as e + ̀ - .replace(/[\u0300-\u036F]/g, ''); // removes combining marks + .replaceAll(/[\u0300-\u036F]/g, ''); // removes combining marks result = [...result] .map((char) => { @@ -681,8 +681,8 @@ export class InternetModule extends ModuleBase { return charCode.toString(36); }) .join(''); - result = result.toString().replace(/'/g, ''); - result = result.replace(/ /g, ''); + result = result.toString().replaceAll("'", ''); + result = result.replaceAll(' ', ''); return result; } @@ -844,8 +844,8 @@ export class InternetModule extends ModuleBase { break; } - result = result.toString().replace(/'/g, ''); - result = result.replace(/ /g, ''); + result = result.toString().replaceAll("'", ''); + result = result.replaceAll(' ', ''); return result; } -- cgit v1.2.3