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

index.ts:207

Properties

exclusionsRegexps

exclusionsRegexps: RegExp[]

Prepared regexps for exclusions

Defined in

index.ts:179

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

index.ts:242


check

check(word): boolean

Check whether the particular word is bad or not

Parameters

Name Type
word string

Returns

boolean

Defined in

index.ts:351


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

Defined in

index.ts:390