BadWordsNext - alexzel/bad-words-next GitHub Wiki
Class: BadWordsNext
Main library class implementing profanity filtering and detection
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new BadWordsNext(opts?
)
Create an instance of BadWordsNext class
Parameters
Name | Type |
---|---|
opts? |
Options |
Defined in
Properties
exclusionsRegexps
• exclusionsRegexps: RegExp
[]
Prepared regexps for exclusions
Defined in
Methods
add
▸ add(data
): void
Add dictionary data for bad words filtering and detection
Parameters
Name | Type | Description |
---|---|---|
data |
Data |
Dictionary data |
Returns
void
Defined in
check
▸ check(word
): boolean
Check whether the particular word is bad or not
Parameters
Name | Type |
---|---|
word |
string |
Returns
boolean
Defined in
filter
▸ filter(str
, onCatch?
): string
Filter bad words in the input string and replace them with a placeholder
Parameters
Name | Type |
---|---|
str |
string |
onCatch? |
(badword : string ) => void |
Returns
string