glin-profanity 2.1.0 → 2.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +205 -55
- package/dist/index.cjs +5590 -0
- package/dist/index.d.cts +120 -0
- package/dist/index.d.ts +120 -0
- package/dist/index.js +5572 -0
- package/package.json +37 -13
- package/lib/cjs/data/Norwegian.json +0 -17
- package/lib/cjs/data/arabic.json +0 -157
- package/lib/cjs/data/chinese.json +0 -298
- package/lib/cjs/data/czech.json +0 -45
- package/lib/cjs/data/danish.json +0 -24
- package/lib/cjs/data/dictionary.d.ts +0 -25
- package/lib/cjs/data/dictionary.js +0 -52
- package/lib/cjs/data/dictionary.js.map +0 -1
- package/lib/cjs/data/english.json +0 -410
- package/lib/cjs/data/esperanto.json +0 -41
- package/lib/cjs/data/finnish.json +0 -134
- package/lib/cjs/data/french.json +0 -99
- package/lib/cjs/data/german.json +0 -69
- package/lib/cjs/data/globalWhitelist.json +0 -31
- package/lib/cjs/data/hindi.json +0 -100
- package/lib/cjs/data/hungarian.json +0 -100
- package/lib/cjs/data/italian.json +0 -184
- package/lib/cjs/data/japanese.json +0 -189
- package/lib/cjs/data/korean.json +0 -76
- package/lib/cjs/data/persian.json +0 -49
- package/lib/cjs/data/polish.json +0 -57
- package/lib/cjs/data/portuguese.json +0 -78
- package/lib/cjs/data/russian.json +0 -156
- package/lib/cjs/data/swedish.json +0 -47
- package/lib/cjs/data/thai.json +0 -35
- package/lib/cjs/data/turkish.json +0 -195
- package/lib/cjs/filters/Filter.d.ts +0 -39
- package/lib/cjs/filters/Filter.js +0 -162
- package/lib/cjs/filters/Filter.js.map +0 -1
- package/lib/cjs/hooks/useProfanityChecker.d.ts +0 -34
- package/lib/cjs/hooks/useProfanityChecker.js +0 -68
- package/lib/cjs/hooks/useProfanityChecker.js.map +0 -1
- package/lib/cjs/index.d.ts +0 -4
- package/lib/cjs/index.js +0 -10
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/types/types.d.ts +0 -21
- package/lib/cjs/types/types.js +0 -11
- package/lib/cjs/types/types.js.map +0 -1
- package/lib/esm/data/Norwegian.json +0 -17
- package/lib/esm/data/arabic.json +0 -157
- package/lib/esm/data/chinese.json +0 -298
- package/lib/esm/data/czech.json +0 -45
- package/lib/esm/data/danish.json +0 -24
- package/lib/esm/data/dictionary.d.ts +0 -25
- package/lib/esm/data/dictionary.js +0 -47
- package/lib/esm/data/dictionary.js.map +0 -1
- package/lib/esm/data/english.json +0 -410
- package/lib/esm/data/esperanto.json +0 -41
- package/lib/esm/data/finnish.json +0 -134
- package/lib/esm/data/french.json +0 -99
- package/lib/esm/data/german.json +0 -69
- package/lib/esm/data/globalWhitelist.json +0 -31
- package/lib/esm/data/hindi.json +0 -100
- package/lib/esm/data/hungarian.json +0 -100
- package/lib/esm/data/italian.json +0 -184
- package/lib/esm/data/japanese.json +0 -189
- package/lib/esm/data/korean.json +0 -76
- package/lib/esm/data/persian.json +0 -49
- package/lib/esm/data/polish.json +0 -57
- package/lib/esm/data/portuguese.json +0 -78
- package/lib/esm/data/russian.json +0 -156
- package/lib/esm/data/swedish.json +0 -47
- package/lib/esm/data/thai.json +0 -35
- package/lib/esm/data/turkish.json +0 -195
- package/lib/esm/filters/Filter.d.ts +0 -39
- package/lib/esm/filters/Filter.js +0 -156
- package/lib/esm/filters/Filter.js.map +0 -1
- package/lib/esm/hooks/useProfanityChecker.d.ts +0 -34
- package/lib/esm/hooks/useProfanityChecker.js +0 -61
- package/lib/esm/hooks/useProfanityChecker.js.map +0 -1
- package/lib/esm/index.d.ts +0 -4
- package/lib/esm/index.js +0 -4
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/types/types.d.ts +0 -21
- package/lib/esm/types/types.js +0 -8
- package/lib/esm/types/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
|
|
63
63
|
## ✨ Overview
|
|
64
64
|
|
|
65
|
-
**Glin-Profanity** is a high-performance JavaScript/TypeScript library built to detect, filter, and sanitize profane or harmful language in user-generated content. With support for over 20+ languages, configurable severity levels, obfuscation detection, and
|
|
65
|
+
**Glin-Profanity** is a high-performance JavaScript/TypeScript library built to detect, filter, and sanitize profane or harmful language in user-generated content. With support for over 20+ languages, configurable severity levels, obfuscation detection, and framework-agnostic design, it's perfect for developers who care about building safe, inclusive platforms.
|
|
66
66
|
|
|
67
67
|
Whether you're moderating chat messages, community forums, or content input forms, Glin-Profanity empowers you to:
|
|
68
68
|
|
|
@@ -71,17 +71,28 @@ Whether you're moderating chat messages, community forums, or content input form
|
|
|
71
71
|
- 💬 Catch obfuscated profanity like `sh1t`, `f*ck`, `a$$hole`
|
|
72
72
|
- 🎚️ Adjust severity thresholds (`Exact`, `Fuzzy`, `Merged`)
|
|
73
73
|
- 🔁 Replace bad words with symbols or emojis
|
|
74
|
-
- 🧩
|
|
74
|
+
- 🧩 Works in **any JavaScript environment** - <img src="https://img.shields.io/badge/Node.js-339933?style=flat&logo=nodedotjs&logoColor=white" alt="Node.js" height="16" /> <img src="https://img.shields.io/badge/React-20232A?style=flat&logo=react&logoColor=61DAFB" alt="React" height="16" /> <img src="https://img.shields.io/badge/Vue-35495E?style=flat&logo=vuedotjs&logoColor=4FC08D" alt="Vue" height="16" /> <img src="https://img.shields.io/badge/Angular-DD0031?style=flat&logo=angular&logoColor=white" alt="Angular" height="16" /> <img src="https://img.shields.io/badge/TypeScript-007ACC?style=flat&logo=typescript&logoColor=white" alt="TypeScript" height="16" />
|
|
75
75
|
- 🛡️ Add custom word lists or ignore specific terms
|
|
76
76
|
|
|
77
|
+
## 🚀 Key Features
|
|
78
|
+
|
|
79
|
+
<div align="center">
|
|
80
|
+
<img src="https://img.shields.io/badge/Multi--Language-🌍-blue?style=for-the-badge" alt="Multi-Language" />
|
|
81
|
+
<img src="https://img.shields.io/badge/Real--Time-⚡-yellow?style=for-the-badge" alt="Real-Time" />
|
|
82
|
+
<img src="https://img.shields.io/badge/Obfuscation_Detection-🕵️-purple?style=for-the-badge" alt="Obfuscation" />
|
|
83
|
+
<img src="https://img.shields.io/badge/Framework_Agnostic-🧩-green?style=for-the-badge" alt="Framework Agnostic" />
|
|
84
|
+
</div>
|
|
85
|
+
|
|
77
86
|
## 📚 Table of Contents
|
|
78
87
|
|
|
79
|
-
- [🚀 Features](#-features)
|
|
88
|
+
- [🚀 Key Features](#-key-features)
|
|
80
89
|
- [📦 Installation](#installation)
|
|
81
90
|
- [🌍 Supported Languages](#supported-languages)
|
|
82
91
|
- [⚙️ Usage](#usage)
|
|
83
92
|
- [Basic Usage](#basic-usage)
|
|
93
|
+
- [Framework Examples](#framework-examples)
|
|
84
94
|
- [🧠 API](#api)
|
|
95
|
+
- [Core Functions](#core-functions)
|
|
85
96
|
- [Filter Class](#filter-class)
|
|
86
97
|
- [Constructor](#constructor)
|
|
87
98
|
- [FilterConfig Options](#filterconfig-options)
|
|
@@ -98,6 +109,14 @@ Whether you're moderating chat messages, community forums, or content input form
|
|
|
98
109
|
|
|
99
110
|
## Installation
|
|
100
111
|
|
|
112
|
+
<div align="center">
|
|
113
|
+
<img src="https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white" alt="npm" />
|
|
114
|
+
<img src="https://img.shields.io/badge/Yarn-2C8EBB?style=for-the-badge&logo=yarn&logoColor=white" alt="yarn" />
|
|
115
|
+
<img src="https://img.shields.io/badge/pnpm-F69220?style=for-the-badge&logo=pnpm&logoColor=white" alt="pnpm" />
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<br />
|
|
119
|
+
|
|
101
120
|
To install Glin-Profanity, use npm:
|
|
102
121
|
|
|
103
122
|
```bash
|
|
@@ -108,85 +127,223 @@ OR
|
|
|
108
127
|
```bash
|
|
109
128
|
yarn add glin-profanity
|
|
110
129
|
```
|
|
130
|
+
OR
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
pnpm add glin-profanity
|
|
134
|
+
```
|
|
111
135
|
|
|
112
|
-
|
|
136
|
+
## Supported Languages
|
|
113
137
|
|
|
114
|
-
|
|
138
|
+
Glin-Profanity includes comprehensive profanity dictionaries for **23 languages**:
|
|
139
|
+
|
|
140
|
+
🇸🇦 **Arabic** • 🇨🇳 **Chinese** • 🇨🇿 **Czech** • 🇩🇰 **Danish** • 🇬🇧 **English** • 🌍 **Esperanto** • 🇫🇮 **Finnish** • 🇫🇷 **French** • 🇩🇪 **German** • 🇮🇳 **Hindi** • 🇭🇺 **Hungarian** • 🇮🇹 **Italian** • 🇯🇵 **Japanese** • 🇰🇷 **Korean** • 🇳🇴 **Norwegian** • 🇮🇷 **Persian** • 🇵🇱 **Polish** • 🇵🇹 **Portuguese** • 🇷🇺 **Russian** • 🇪🇸 **Spanish** • 🇸🇪 **Swedish** • 🇹🇭 **Thai** • 🇹🇷 **Turkish**
|
|
141
|
+
|
|
142
|
+
> **Note**: The JavaScript and Python packages maintain cross-language parity, ensuring consistent profanity detection across both ecosystems.
|
|
115
143
|
|
|
116
144
|
## Usage
|
|
117
145
|
|
|
118
146
|
### Basic Usage
|
|
119
147
|
|
|
120
|
-
|
|
148
|
+
Glin-Profanity now provides framework-agnostic core functions alongside React-specific hooks:
|
|
149
|
+
|
|
150
|
+
#### 🟢 Node.js / Vanilla JavaScript
|
|
151
|
+
|
|
152
|
+
```javascript
|
|
153
|
+
const { checkProfanity } = require('glin-profanity');
|
|
154
|
+
|
|
155
|
+
const text = "This is some bad text with damn words";
|
|
156
|
+
const result = checkProfanity(text, {
|
|
157
|
+
languages: ['english', 'spanish'],
|
|
158
|
+
replaceWith: '***'
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
console.log(result.containsProfanity); // true
|
|
162
|
+
console.log(result.profaneWords); // ['damn']
|
|
163
|
+
console.log(result.processedText); // "This is some bad text with *** words"
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### 🔷 TypeScript
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
import { checkProfanity, ProfanityCheckerConfig } from 'glin-profanity';
|
|
170
|
+
|
|
171
|
+
const config: ProfanityCheckerConfig = {
|
|
172
|
+
languages: ['english', 'spanish'],
|
|
173
|
+
severityLevels: true,
|
|
174
|
+
autoReplace: true,
|
|
175
|
+
replaceWith: '🤬'
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const result = checkProfanity("inappropriate text", config);
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Framework Examples
|
|
182
|
+
|
|
183
|
+
<div align="center">
|
|
184
|
+
<img src="https://img.shields.io/badge/Node.js-339933?style=for-the-badge&logo=nodedotjs&logoColor=white" alt="Node.js" />
|
|
185
|
+
<img src="https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB" alt="React" />
|
|
186
|
+
<img src="https://img.shields.io/badge/Vue.js-35495E?style=for-the-badge&logo=vuedotjs&logoColor=4FC08D" alt="Vue.js" />
|
|
187
|
+
<img src="https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular&logoColor=white" alt="Angular" />
|
|
188
|
+
<img src="https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript" />
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
#### ⚛️ React
|
|
121
192
|
|
|
122
193
|
```tsx
|
|
123
194
|
import React, { useState } from 'react';
|
|
124
|
-
import { useProfanityChecker, SeverityLevel
|
|
195
|
+
import { useProfanityChecker, SeverityLevel } from 'glin-profanity';
|
|
125
196
|
|
|
126
197
|
const App = () => {
|
|
127
198
|
const [text, setText] = useState('');
|
|
128
|
-
|
|
129
|
-
const [replaceWith, setReplaceWith] = useState('***');
|
|
130
|
-
const [minSeverity, setMinSeverity] = useState(SeverityLevel.Exact);
|
|
131
|
-
|
|
199
|
+
|
|
132
200
|
const { result, checkText } = useProfanityChecker({
|
|
133
|
-
|
|
201
|
+
languages: ['english', 'spanish'],
|
|
134
202
|
severityLevels: true,
|
|
135
|
-
autoReplace,
|
|
136
|
-
replaceWith,
|
|
137
|
-
minSeverity
|
|
138
|
-
customActions: (res) => {
|
|
139
|
-
console.log('[Detected]', res.profaneWords);
|
|
140
|
-
},
|
|
203
|
+
autoReplace: true,
|
|
204
|
+
replaceWith: '***',
|
|
205
|
+
minSeverity: SeverityLevel.EXACT
|
|
141
206
|
});
|
|
142
207
|
|
|
143
208
|
return (
|
|
144
209
|
<div>
|
|
145
210
|
<input value={text} onChange={(e) => setText(e.target.value)} />
|
|
146
211
|
<button onClick={() => checkText(text)}>Scan</button>
|
|
147
|
-
|
|
148
|
-
{result && (
|
|
149
|
-
|
|
150
|
-
<p>Contains Profanity: {result.containsProfanity ? 'Yes' : 'No'}</p>
|
|
151
|
-
{result.containsProfanity && (
|
|
152
|
-
<>
|
|
153
|
-
<p>Detected: {result.profaneWords.join(', ')}</p>
|
|
154
|
-
<p>Replaced: {result.processedText}</p>
|
|
155
|
-
</>
|
|
156
|
-
)}
|
|
157
|
-
</>
|
|
212
|
+
|
|
213
|
+
{result && result.containsProfanity && (
|
|
214
|
+
<p>Cleaned: {result.processedText}</p>
|
|
158
215
|
)}
|
|
159
216
|
</div>
|
|
160
217
|
);
|
|
161
218
|
};
|
|
162
219
|
```
|
|
163
220
|
|
|
221
|
+
#### 💚 Vue 3
|
|
222
|
+
|
|
223
|
+
```vue
|
|
224
|
+
<template>
|
|
225
|
+
<div>
|
|
226
|
+
<input v-model="text" @input="checkContent" />
|
|
227
|
+
<p v-if="hasProfanity">{{ cleanedText }}</p>
|
|
228
|
+
</div>
|
|
229
|
+
</template>
|
|
230
|
+
|
|
231
|
+
<script setup>
|
|
232
|
+
import { ref } from 'vue';
|
|
233
|
+
import { checkProfanity } from 'glin-profanity';
|
|
234
|
+
|
|
235
|
+
const text = ref('');
|
|
236
|
+
const hasProfanity = ref(false);
|
|
237
|
+
const cleanedText = ref('');
|
|
238
|
+
|
|
239
|
+
const checkContent = () => {
|
|
240
|
+
const result = checkProfanity(text.value, {
|
|
241
|
+
languages: ['english'],
|
|
242
|
+
autoReplace: true,
|
|
243
|
+
replaceWith: '***'
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
hasProfanity.value = result.containsProfanity;
|
|
247
|
+
cleanedText.value = result.autoReplaced;
|
|
248
|
+
};
|
|
249
|
+
</script>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
#### 🔴 Angular
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
import { Component } from '@angular/core';
|
|
256
|
+
import { checkProfanity, ProfanityCheckResult } from 'glin-profanity';
|
|
257
|
+
|
|
258
|
+
@Component({
|
|
259
|
+
selector: 'app-comment',
|
|
260
|
+
template: `
|
|
261
|
+
<textarea [(ngModel)]="comment" (ngModelChange)="validateComment()"></textarea>
|
|
262
|
+
<div *ngIf="profanityResult?.containsProfanity" class="error">
|
|
263
|
+
Please remove inappropriate language
|
|
264
|
+
</div>
|
|
265
|
+
`
|
|
266
|
+
})
|
|
267
|
+
export class CommentComponent {
|
|
268
|
+
comment = '';
|
|
269
|
+
profanityResult: ProfanityCheckResult | null = null;
|
|
270
|
+
|
|
271
|
+
validateComment() {
|
|
272
|
+
this.profanityResult = checkProfanity(this.comment, {
|
|
273
|
+
languages: ['english', 'spanish'],
|
|
274
|
+
severityLevels: true
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
#### 🚂 Express.js Middleware
|
|
281
|
+
|
|
282
|
+
```javascript
|
|
283
|
+
const express = require('express');
|
|
284
|
+
const { checkProfanity } = require('glin-profanity');
|
|
285
|
+
|
|
286
|
+
const profanityMiddleware = (req, res, next) => {
|
|
287
|
+
const result = checkProfanity(req.body.message || '', {
|
|
288
|
+
languages: ['english'],
|
|
289
|
+
autoReplace: true,
|
|
290
|
+
replaceWith: '[censored]'
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
if (result.containsProfanity) {
|
|
294
|
+
req.body.message = result.autoReplaced;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
next();
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
app.post('/comment', profanityMiddleware, (req, res) => {
|
|
301
|
+
// Message is now sanitized
|
|
302
|
+
res.json({ message: req.body.message });
|
|
303
|
+
});
|
|
304
|
+
```
|
|
164
305
|
|
|
165
306
|
## API
|
|
166
307
|
|
|
167
|
-
###
|
|
308
|
+
### 🎯 Core Functions
|
|
309
|
+
|
|
310
|
+
#### `checkProfanity`
|
|
311
|
+
|
|
312
|
+
Framework-agnostic function for profanity detection.
|
|
313
|
+
|
|
314
|
+
```typescript
|
|
315
|
+
checkProfanity(text: string, config?: ProfanityCheckerConfig): ProfanityCheckResult
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
#### `checkProfanityAsync`
|
|
319
|
+
|
|
320
|
+
Async version of checkProfanity.
|
|
321
|
+
|
|
322
|
+
```typescript
|
|
323
|
+
checkProfanityAsync(text: string, config?: ProfanityCheckerConfig): Promise<ProfanityCheckResult>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
#### `isWordProfane`
|
|
327
|
+
|
|
328
|
+
Quick check if a single word is profane.
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
isWordProfane(word: string, config?: ProfanityCheckerConfig): boolean
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### 🔧 `Filter` Class
|
|
168
335
|
|
|
169
336
|
#### Constructor
|
|
170
337
|
|
|
171
338
|
```typescript
|
|
172
|
-
new Filter(config?:
|
|
173
|
-
languages?: Language[];
|
|
174
|
-
allLanguages?: boolean;
|
|
175
|
-
caseSensitive?: boolean;
|
|
176
|
-
wordBoundaries?: boolean;
|
|
177
|
-
customWords?: string[];
|
|
178
|
-
replaceWith?: string;
|
|
179
|
-
severityLevels?: boolean;
|
|
180
|
-
ignoreWords?: string[];
|
|
181
|
-
logProfanity?: boolean;
|
|
182
|
-
});
|
|
339
|
+
new Filter(config?: FilterConfig);
|
|
183
340
|
```
|
|
184
341
|
|
|
185
342
|
#### FilterConfig Options:
|
|
186
343
|
|
|
187
344
|
| Option | Type | Description |
|
|
188
345
|
|-------------------------|--------------------|-------------|
|
|
189
|
-
| `languages` | `Language[]` | Languages to include |
|
|
346
|
+
| `languages` | `Language[]` | Languages to include (e.g., ['english', 'spanish']) |
|
|
190
347
|
| `allLanguages` | `boolean` | If true, scan all available languages |
|
|
191
348
|
| `caseSensitive` | `boolean` | Match case exactly |
|
|
192
349
|
| `wordBoundaries` | `boolean` | Only match full words (turn off for substring matching) |
|
|
@@ -231,32 +388,25 @@ checkProfanity(text: string): CheckProfanityResult;
|
|
|
231
388
|
- `processedText`: `string` - The text with profane words replaced (if `replaceWith` is specified).
|
|
232
389
|
- `severityMap`: `{ [word: string]: number }` - A map of profane words to their severity levels (if `severityLevels` is specified).
|
|
233
390
|
|
|
234
|
-
### `useProfanityChecker` Hook
|
|
391
|
+
### ⚛️ `useProfanityChecker` Hook
|
|
235
392
|
|
|
236
393
|
A custom React hook for using the profanity checker.
|
|
237
394
|
|
|
238
395
|
#### Parameters
|
|
239
396
|
|
|
240
|
-
- `config`: An optional configuration object.
|
|
241
|
-
- `languages`: An array of languages to check for profanities.
|
|
242
|
-
- `allLanguages`: A boolean indicating whether to check for all languages.
|
|
243
|
-
- `caseSensitive`: A boolean indicating whether the profanity check should be case-sensitive.
|
|
244
|
-
- `wordBoundaries`: A boolean indicating whether to consider word boundaries when checking for profanities.
|
|
245
|
-
- `customWords`: An array of custom words to include in the profanity check.
|
|
246
|
-
- `replaceWith`: A string to replace profane words with.
|
|
247
|
-
- `severityLevels`: A boolean indicating whether to include severity levels for profane words.
|
|
248
|
-
- `ignoreWords`: An array of words to ignore in the profanity check.
|
|
249
|
-
- `logProfanity`: A boolean indicating whether to log detected profane words.
|
|
250
|
-
- `customActions`: A function to execute custom actions when profanity is detected.
|
|
397
|
+
- `config`: An optional configuration object (same as ProfanityCheckerConfig).
|
|
251
398
|
|
|
252
399
|
#### Return Value
|
|
253
400
|
|
|
254
401
|
- `result`: The result of the profanity check.
|
|
255
402
|
- `checkText`: A function to check a given text for profanities.
|
|
256
403
|
- `checkTextAsync`: A function to check a given text for profanities asynchronously.
|
|
404
|
+
- `reset`: A function to reset the result state.
|
|
405
|
+
- `isDirty`: Boolean indicating if profanity was found.
|
|
406
|
+
- `isWordProfane`: Function to check if a single word is profane.
|
|
257
407
|
|
|
258
408
|
```typescript
|
|
259
|
-
const { result, checkText, checkTextAsync } = useProfanityChecker(config);
|
|
409
|
+
const { result, checkText, checkTextAsync, reset, isDirty, isWordProfane } = useProfanityChecker(config);
|
|
260
410
|
```
|
|
261
411
|
|
|
262
412
|
## Note
|