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

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