mirror of
https://github.com/discourse/discourse.git
synced 2024-12-04 05:43:44 +08:00
13 lines
478 B
JavaScript
13 lines
478 B
JavaScript
import Controller from "@ember/controller";
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
|
|
|
export default Controller.extend(ModalFunctionality, {
|
|
@discourseComputed("value", "model.compiledRegularExpression")
|
|
matches(value, regexpString) {
|
|
if (!value || !regexpString) return;
|
|
let censorRegexp = new RegExp(regexpString, "ig");
|
|
return value.match(censorRegexp);
|
|
}
|
|
});
|