mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-22 17:41:55 +08:00
These have been broken since fd07c943ad
because watched words were not correctly transformed to regexps.
This partially reverts the changes.
9 lines
302 B
JavaScript
Vendored
9 lines
302 B
JavaScript
Vendored
export function createWatchedWordRegExp(word) {
|
|
const caseFlag = word.case_sensitive ? "" : "i";
|
|
return new RegExp(word.regexp, `${caseFlag}gu`);
|
|
}
|
|
|
|
export function toWatchedWord(regexp) {
|
|
const [[regexpString, options]] = Object.entries(regexp);
|
|
return { ...options, regexp: regexpString };
|
|
}
|