mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-18 23:09:59 +00:00
6 lines
248 B
TypeScript
6 lines
248 B
TypeScript
import escapeStringRegexp from "escape-string-regexp";
|
|
|
|
export function mergeWordsIntoRegex(words: string[], flags?: string) {
|
|
const source = words.map((word) => `(?:${escapeStringRegexp(word)})`).join("|");
|
|
return new RegExp(source, flags);
|
|
}
|