From 123ee290d3145fb36b2a208ad31833a3f6848367 Mon Sep 17 00:00:00 2001 From: Maicol Battistini Date: Fri, 5 May 2023 11:16:42 +0200 Subject: [PATCH] =?UTF-8?q?perf:=20=E2=9A=A1=20Ottimizzata=20regex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/ts/utils/misc.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/ts/utils/misc.ts b/resources/ts/utils/misc.ts index 042825ff6..3b89ef451 100644 --- a/resources/ts/utils/misc.ts +++ b/resources/ts/utils/misc.ts @@ -1,4 +1,4 @@ -// noinspection JSUnusedGlobalSymbols +// noinspection JSUnusedGlobalSymbols,OverlyComplexBooleanExpressionJS import '@material/mwc-snackbar'; import '@material/web/button/text-button.js'; @@ -24,7 +24,6 @@ export function isMobile() { } export function isVnode(object_: any): object_ is Vnode { - // noinspection OverlyComplexBooleanExpressionJS // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access return (object_ && !Array.isArray(object_) && object_.tag && object_.attrs) as boolean; } @@ -49,7 +48,7 @@ export function subclassOf(object_: GenericObject, parentObject: any): boolean { * Check if a string contains HTML code/tags */ export function containsHTML(string_: string): boolean { - return /<([A-Za-z][\dA-Za-z]*)\b[^>]*>(?:.|\n)*?<\/\1>/.test(string_); + return /<(?[A-Za-z][\dA-Za-z]*)\b[^>]*>(?:.|\n)*?<\/\k>/.test(string_); } /**