From: Jérôme Benoit Date: Fri, 29 Dec 2023 22:50:53 +0000 (+0100) Subject: build: use literal regexp for loopback address matching X-Git-Tag: v1.2.31~12 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=bbb339cc4034016235193fa39d905ed0540b50f7;p=e-mobility-charging-stations-simulator.git build: use literal regexp for loopback address matching Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ui-server/UIServerUtils.ts b/src/charging-station/ui-server/UIServerUtils.ts index 2056c209..a4f3bf51 100644 --- a/src/charging-station/ui-server/UIServerUtils.ts +++ b/src/charging-station/ui-server/UIServerUtils.ts @@ -49,12 +49,7 @@ export class UIServerUtils { } public static isLoopback (address: string): boolean { - // eslint-disable-next-line prefer-regex-literals - const isLoopbackRegExp = new RegExp( - // eslint-disable-next-line no-useless-escape - /^localhost$|^127(?:\.\d+){0,2}\.\d+$|^(?:0*\:)*?:?0*1$/, - 'i' - ) - return isLoopbackRegExp.test(address) + // eslint-disable-next-line no-useless-escape + return /^localhost$|^127(?:\.\d+){0,2}\.\d+$|^(?:0*\:)*?:?0*1$/i.test(address) } }