mirror of
https://github.com/discourse/discourse.git
synced 2024-12-03 15:53:41 +08:00
10 lines
301 B
JavaScript
10 lines
301 B
JavaScript
|
export function createWatchedWordRegExp(word) {
|
||
|
const caseFlag = word.case_sensitive ? "" : "i";
|
||
|
return new RegExp(word.regexp, `${caseFlag}g`);
|
||
|
}
|
||
|
|
||
|
export function toWatchedWord(regexp) {
|
||
|
const [[regexpString, options]] = Object.entries(regexp);
|
||
|
return { regexp: regexpString, ...options };
|
||
|
}
|