pref: change detectors from .match into .test

there is no need for matching, capturing results, and validating nullablity
just using `.test` would be enough and significantly faster

for more info, see https://stackoverflow.com/10940138/16476610
This commit is contained in:
Yokozuna59
2023-06-12 14:45:08 +03:00
parent b11c511c5c
commit e688138167
21 changed files with 26 additions and 33 deletions

View File

@@ -1,10 +1,9 @@
import type { ExternalDiagramDefinition } from 'mermaid';
const id = 'zenuml';
const regexp = /^\s*zenuml/;
const detector = (txt: string) => {
return txt.match(regexp) !== null;
return /^\s*zenuml/.test(txt);
};
const loader = async () => {