Skip to content

Commit 47f6715

Browse files
committed
refactor: prefer test to check if the string matches the regexp
1 parent 3fb59af commit 47f6715

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/component-meta/lib/base.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ ${commandLine.vueOptions.target < 3 ? vue2TypeHelpersCode : typeHelpersCode}
315315

316316
return resolveNestedProperties(prop);
317317
})
318-
.filter(prop => !prop.name.match(propEventRegex));
318+
.filter(prop => !propEventRegex.test(prop.name));
319319
}
320320

321321
// fill global

packages/language-core/lib/plugins/file-vue.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const plugin: VueLanguagePlugin = ({ vueCompilerOptions }) => {
4747

4848
// #3449
4949
const endTagRegex = new RegExp(`</\\s*${hitBlock.type}\\s*>`);
50-
const insertedEndTag = !!oldContent.match(endTagRegex) !== !!newContent.match(endTagRegex);
50+
const insertedEndTag = endTagRegex.test(oldContent) !== endTagRegex.test(newContent);
5151
if (insertedEndTag) {
5252
return;
5353
}

0 commit comments

Comments
 (0)