badword-filter
v1.1.5
Published
Bad word filter for English & Turkish words
Downloads
16
Maintainers
Readme
Bad Word Filter for EN && TR lang words
You may filter quickly your strings in a couple steps. You can check is provided string is valid ? or you can simply replace bad word with given character.(You can use swear words list only for English language for now.)
Related Functions
You can import related functions as follows;
import { checkIsValid, replaceWordWith } from 'badword-filter';
checkIsValid
This function takes two args and returns boolean as validation result. You can use swear words list only for English language for now.
const ValidationOptions: object = {
swear: boolean,
negative: boolean,
political: boolean,
religions: boolean,
};
checkIsValid('word', ValidationOptions);
| Parameter | Type | Description |
| :------------------ | :------- | :-------------------------------------------- |
| data
| string
| Required. Your string to validate. |
| ValidationOptions
| object
| Required. Your wished badword list types. |
replaceWordWith
This function takes three args and returns masked string with given pattern as validation result. You can use swear words list only for English language for now.
const ValidationOptions: object = {
swear: boolean,
negative: boolean,
political: boolean,
religions: boolean,
};
replaceWordWith('word', '*', ValidationOptions);
| Parameter | Type | Description |
| :--------------------- | :------- | :------------------------------------------------------ |
| data
| string
| Required. Your string to validate. |
| replacementCharacter
| string
| Required. Your special character using as replacer. |
| ValidationOptions
| object
| Required. Your wished badword list types. |