From ea82b03cd6d40c6bd541046f2f9aedfed058ff4f Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Wed, 7 Aug 2024 16:01:23 +0800 Subject: Improve regex performance (#11635) --- packages/integrations/markdoc/src/content-entry-type.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/integrations/markdoc/src') diff --git a/packages/integrations/markdoc/src/content-entry-type.ts b/packages/integrations/markdoc/src/content-entry-type.ts index 8fc4bd77c..bd19e1ccd 100644 --- a/packages/integrations/markdoc/src/content-entry-type.ts +++ b/packages/integrations/markdoc/src/content-entry-type.ts @@ -245,7 +245,7 @@ function raiseValidationErrors({ e.error.id !== 'variable-undefined' && // Ignore missing partial errors. // We will resolve these in `resolvePartials`. - !(e.error.id === 'attribute-value-invalid' && e.error.message.match(/^Partial .+ not found/)) + !(e.error.id === 'attribute-value-invalid' && /^Partial .+ not found/.test(e.error.message)) ); }); @@ -275,7 +275,7 @@ function getUsedTags(markdocAst: Node) { // This is our signal that a tag is being used! for (const { error } of validationErrors) { if (error.id === 'tag-undefined') { - const [, tagName] = error.message.match(/Undefined tag: '(.*)'/) ?? []; + const [, tagName] = /Undefined tag: '(.*)'/.exec(error.message) ?? []; tags.add(tagName); } } -- cgit v1.2.3