Skip to content

Commit

Permalink
Merge pull request #119 from dmrobbins03/master
Browse files Browse the repository at this point in the history
Single words that are not profane will cause an error.
  • Loading branch information
smilephoenix103 authored Jan 26, 2023
2 parents bdaed0b + cf8e4bc commit dc18682
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 1,187 deletions.
3 changes: 2 additions & 1 deletion lib/badwords.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Filter {
* @param {string} string - Sentence to filter.
*/
clean(string) {
if (!this.splitRegex.exec(string)) return string;
return string.split(this.splitRegex).map((word) => {
return this.isProfane(word) ? this.replaceWord(word) : word;
}).join(this.splitRegex.exec(string)[0]);
Expand Down Expand Up @@ -85,4 +86,4 @@ class Filter {
}
}

module.exports = Filter;
module.exports = Filter;
Loading

0 comments on commit dc18682

Please sign in to comment.