diff --git a/src/processTemplate.ts b/src/processTemplate.ts index 08500a0f..f3ca1e51 100755 --- a/src/processTemplate.ts +++ b/src/processTemplate.ts @@ -549,11 +549,12 @@ const builtInCommands = [ 'IMAGE', 'LINK', 'HTML', -]; +] as const; + +const builtInRegexes = builtInCommands.map(word => new RegExp(`^${word}\\b`)); + const notBuiltIns = (cmd: string) => - !builtInCommands.some(word => - new RegExp(`^${word}\\b`).test(cmd.toUpperCase()) - ); + !builtInRegexes.some(r => r.test(cmd.toUpperCase())); const getCommand = (ctx: Context): string => { let { cmd } = ctx;