glin-profanity 2.3.3 → 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/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 +13 -12
- package/lib/cjs/packages/js/src/core/index.d.ts +0 -4
- package/lib/cjs/packages/js/src/core/index.js +0 -55
- package/lib/cjs/packages/js/src/core/index.js.map +0 -1
- package/lib/cjs/packages/js/src/core/types.d.ts +0 -20
- package/lib/cjs/packages/js/src/core/types.js +0 -3
- package/lib/cjs/packages/js/src/core/types.js.map +0 -1
- package/lib/cjs/packages/js/src/data/dictionary.d.ts +0 -26
- package/lib/cjs/packages/js/src/data/dictionary.js +0 -54
- package/lib/cjs/packages/js/src/data/dictionary.js.map +0 -1
- package/lib/cjs/packages/js/src/filters/Filter.d.ts +0 -32
- package/lib/cjs/packages/js/src/filters/Filter.js +0 -246
- package/lib/cjs/packages/js/src/filters/Filter.js.map +0 -1
- package/lib/cjs/packages/js/src/hooks/useProfanityChecker.d.ts +0 -11
- package/lib/cjs/packages/js/src/hooks/useProfanityChecker.js +0 -42
- package/lib/cjs/packages/js/src/hooks/useProfanityChecker.js.map +0 -1
- package/lib/cjs/packages/js/src/index.d.ts +0 -12
- package/lib/cjs/packages/js/src/index.js +0 -24
- package/lib/cjs/packages/js/src/index.js.map +0 -1
- package/lib/cjs/packages/js/src/nlp/contextAnalyzer.d.ts +0 -35
- package/lib/cjs/packages/js/src/nlp/contextAnalyzer.js +0 -203
- package/lib/cjs/packages/js/src/nlp/contextAnalyzer.js.map +0 -1
- package/lib/cjs/packages/js/src/types/types.d.ts +0 -56
- package/lib/cjs/packages/js/src/types/types.js +0 -14
- package/lib/cjs/packages/js/src/types/types.js.map +0 -1
- package/lib/cjs/shared/dictionaries/Norwegian.json +0 -17
- package/lib/cjs/shared/dictionaries/arabic.json +0 -157
- package/lib/cjs/shared/dictionaries/chinese.json +0 -298
- package/lib/cjs/shared/dictionaries/czech.json +0 -45
- package/lib/cjs/shared/dictionaries/danish.json +0 -24
- package/lib/cjs/shared/dictionaries/english.json +0 -410
- package/lib/cjs/shared/dictionaries/esperanto.json +0 -41
- package/lib/cjs/shared/dictionaries/finnish.json +0 -134
- package/lib/cjs/shared/dictionaries/french.json +0 -99
- package/lib/cjs/shared/dictionaries/german.json +0 -69
- package/lib/cjs/shared/dictionaries/globalWhitelist.json +0 -31
- package/lib/cjs/shared/dictionaries/hindi.json +0 -100
- package/lib/cjs/shared/dictionaries/hungarian.json +0 -100
- package/lib/cjs/shared/dictionaries/italian.json +0 -184
- package/lib/cjs/shared/dictionaries/japanese.json +0 -189
- package/lib/cjs/shared/dictionaries/korean.json +0 -76
- package/lib/cjs/shared/dictionaries/persian.json +0 -49
- package/lib/cjs/shared/dictionaries/polish.json +0 -57
- package/lib/cjs/shared/dictionaries/portuguese.json +0 -78
- package/lib/cjs/shared/dictionaries/russian.json +0 -156
- package/lib/cjs/shared/dictionaries/spanish.json +0 -72
- package/lib/cjs/shared/dictionaries/swedish.json +0 -47
- package/lib/cjs/shared/dictionaries/thai.json +0 -35
- package/lib/cjs/shared/dictionaries/turkish.json +0 -195
- package/lib/esm/packages/js/src/core/index.d.ts +0 -4
- package/lib/esm/packages/js/src/core/index.js +0 -47
- package/lib/esm/packages/js/src/core/index.js.map +0 -1
- package/lib/esm/packages/js/src/core/types.d.ts +0 -20
- package/lib/esm/packages/js/src/core/types.js +0 -2
- package/lib/esm/packages/js/src/core/types.js.map +0 -1
- package/lib/esm/packages/js/src/data/dictionary.d.ts +0 -26
- package/lib/esm/packages/js/src/data/dictionary.js +0 -49
- package/lib/esm/packages/js/src/data/dictionary.js.map +0 -1
- package/lib/esm/packages/js/src/filters/Filter.d.ts +0 -32
- package/lib/esm/packages/js/src/filters/Filter.js +0 -240
- package/lib/esm/packages/js/src/filters/Filter.js.map +0 -1
- package/lib/esm/packages/js/src/hooks/useProfanityChecker.d.ts +0 -11
- package/lib/esm/packages/js/src/hooks/useProfanityChecker.js +0 -38
- package/lib/esm/packages/js/src/hooks/useProfanityChecker.js.map +0 -1
- package/lib/esm/packages/js/src/index.d.ts +0 -12
- package/lib/esm/packages/js/src/index.js +0 -15
- package/lib/esm/packages/js/src/index.js.map +0 -1
- package/lib/esm/packages/js/src/nlp/contextAnalyzer.d.ts +0 -35
- package/lib/esm/packages/js/src/nlp/contextAnalyzer.js +0 -199
- package/lib/esm/packages/js/src/nlp/contextAnalyzer.js.map +0 -1
- package/lib/esm/packages/js/src/types/types.d.ts +0 -56
- package/lib/esm/packages/js/src/types/types.js +0 -11
- package/lib/esm/packages/js/src/types/types.js.map +0 -1
- package/lib/esm/shared/dictionaries/Norwegian.json +0 -17
- package/lib/esm/shared/dictionaries/arabic.json +0 -157
- package/lib/esm/shared/dictionaries/chinese.json +0 -298
- package/lib/esm/shared/dictionaries/czech.json +0 -45
- package/lib/esm/shared/dictionaries/danish.json +0 -24
- package/lib/esm/shared/dictionaries/english.json +0 -410
- package/lib/esm/shared/dictionaries/esperanto.json +0 -41
- package/lib/esm/shared/dictionaries/finnish.json +0 -134
- package/lib/esm/shared/dictionaries/french.json +0 -99
- package/lib/esm/shared/dictionaries/german.json +0 -69
- package/lib/esm/shared/dictionaries/globalWhitelist.json +0 -31
- package/lib/esm/shared/dictionaries/hindi.json +0 -100
- package/lib/esm/shared/dictionaries/hungarian.json +0 -100
- package/lib/esm/shared/dictionaries/italian.json +0 -184
- package/lib/esm/shared/dictionaries/japanese.json +0 -189
- package/lib/esm/shared/dictionaries/korean.json +0 -76
- package/lib/esm/shared/dictionaries/persian.json +0 -49
- package/lib/esm/shared/dictionaries/polish.json +0 -57
- package/lib/esm/shared/dictionaries/portuguese.json +0 -78
- package/lib/esm/shared/dictionaries/russian.json +0 -156
- package/lib/esm/shared/dictionaries/spanish.json +0 -72
- package/lib/esm/shared/dictionaries/swedish.json +0 -47
- package/lib/esm/shared/dictionaries/thai.json +0 -35
- package/lib/esm/shared/dictionaries/turkish.json +0 -195
package/package.json
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glin-profanity",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.5",
|
|
4
4
|
"description": "Glin-Profanity is a lightweight and efficient npm package designed to detect and filter profane language in text inputs across multiple languages. Whether you’re building a chat application, a comment section, or any platform where user-generated content is involved, Glin-Profanity helps you maintain a clean and respectful environment.",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.mjs",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
11
|
"require": {
|
|
11
|
-
"types": "./
|
|
12
|
-
"default": "./
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
13
14
|
},
|
|
14
15
|
"import": {
|
|
15
|
-
"types": "./
|
|
16
|
-
"default": "./
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.mjs"
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
},
|
|
20
21
|
"files": [
|
|
21
|
-
"
|
|
22
|
+
"dist",
|
|
22
23
|
"README.md"
|
|
23
24
|
],
|
|
24
25
|
"scripts": {
|
|
25
|
-
"build
|
|
26
|
-
"build:esm": "tsc -p tsconfig.esm.json",
|
|
27
|
-
"build": "npm run build:cjs && npm run build:esm",
|
|
26
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
28
27
|
"test": "jest",
|
|
29
28
|
"test:watch": "jest --watch",
|
|
30
29
|
"test:coverage": "jest --coverage",
|
|
@@ -36,6 +35,7 @@
|
|
|
36
35
|
"url": "https://github.com/GLINCKER/glin-profanity"
|
|
37
36
|
},
|
|
38
37
|
"homepage": "https://www.glincker.com/tools/glin-profanity",
|
|
38
|
+
"sideEffects": false,
|
|
39
39
|
"keywords": [
|
|
40
40
|
"profanity",
|
|
41
41
|
"curse",
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
"react-dom": "^18.3.1",
|
|
95
95
|
"semantic-release": "^24.2.7",
|
|
96
96
|
"ts-jest": "^29.4.0",
|
|
97
|
+
"tsup": "^8.2.3",
|
|
97
98
|
"typescript": "^5.8.3"
|
|
98
99
|
}
|
|
99
100
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ProfanityCheckerConfig, ProfanityCheckResult } from './types';
|
|
2
|
-
export declare function checkProfanity(text: string, config?: ProfanityCheckerConfig): ProfanityCheckResult;
|
|
3
|
-
export declare function checkProfanityAsync(text: string, config?: ProfanityCheckerConfig): Promise<ProfanityCheckResult>;
|
|
4
|
-
export declare function isWordProfane(word: string, config?: ProfanityCheckerConfig): boolean;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.checkProfanity = checkProfanity;
|
|
16
|
-
exports.checkProfanityAsync = checkProfanityAsync;
|
|
17
|
-
exports.isWordProfane = isWordProfane;
|
|
18
|
-
const Filter_1 = require("../filters/Filter");
|
|
19
|
-
const globalWhitelist_json_1 = __importDefault(require("@shared/dictionaries/globalWhitelist.json"));
|
|
20
|
-
function createFilterConfig(config) {
|
|
21
|
-
var _a;
|
|
22
|
-
const effective = Object.assign(Object.assign({}, (config !== null && config !== void 0 ? config : {})), { ignoreWords: globalWhitelist_json_1.default.whitelist, fuzzyToleranceLevel: (_a = config === null || config === void 0 ? void 0 : config.fuzzyToleranceLevel) !== null && _a !== void 0 ? _a : 0.8 });
|
|
23
|
-
if (effective.allowObfuscatedMatch && effective.wordBoundaries) {
|
|
24
|
-
console.warn('[Glin-Profanity] Obfuscated match enabled → wordBoundaries will be ignored internally.');
|
|
25
|
-
}
|
|
26
|
-
return effective;
|
|
27
|
-
}
|
|
28
|
-
function checkProfanity(text, config) {
|
|
29
|
-
var _a;
|
|
30
|
-
const filterConfig = createFilterConfig(config);
|
|
31
|
-
const filter = new Filter_1.Filter(filterConfig);
|
|
32
|
-
const checkResult = filter.checkProfanity(text);
|
|
33
|
-
// Filter based on minSeverity (if provided)
|
|
34
|
-
const filteredWords = (config === null || config === void 0 ? void 0 : config.minSeverity) && checkResult.severityMap
|
|
35
|
-
? checkResult.profaneWords.filter((word) => checkResult.severityMap &&
|
|
36
|
-
checkResult.severityMap[word] >= config.minSeverity)
|
|
37
|
-
: checkResult.profaneWords;
|
|
38
|
-
// Optional auto-replace
|
|
39
|
-
const autoReplaced = (config === null || config === void 0 ? void 0 : config.autoReplace) && checkResult.processedText
|
|
40
|
-
? checkResult.processedText
|
|
41
|
-
: text;
|
|
42
|
-
// Custom actions
|
|
43
|
-
(_a = config === null || config === void 0 ? void 0 : config.customActions) === null || _a === void 0 ? void 0 : _a.call(config, checkResult);
|
|
44
|
-
return Object.assign(Object.assign({}, checkResult), { filteredWords,
|
|
45
|
-
autoReplaced });
|
|
46
|
-
}
|
|
47
|
-
function checkProfanityAsync(text, config) {
|
|
48
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
return Promise.resolve(checkProfanity(text, config));
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
function isWordProfane(word, config) {
|
|
53
|
-
return checkProfanity(word, config).containsProfanity;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAoBA,wCA6BC;AAED,kDAEC;AAED,sCAEC;AAzDD,8CAAyD;AAEzD,qGAA4E;AAE5E,SAAS,kBAAkB,CAAC,MAA+B;;IACzD,MAAM,SAAS,mCACV,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,KACjB,WAAW,EAAG,8BAA2B,CAAC,SAAS,EACnD,mBAAmB,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,mBAAmB,mCAAI,GAAG,GACxD,CAAC;IAEF,IAAI,SAAS,CAAC,oBAAoB,IAAI,SAAS,CAAC,cAAc,EAAE,CAAC;QAC/D,OAAO,CAAC,IAAI,CACV,wFAAwF,CACzF,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,cAAc,CAAC,IAAY,EAAE,MAA+B;;IAC1E,MAAM,YAAY,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,YAAY,CAAC,CAAC;IACxC,MAAM,WAAW,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAEhD,4CAA4C;IAC5C,MAAM,aAAa,GACjB,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,KAAI,WAAW,CAAC,WAAW;QAC5C,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,MAAM,CAC7B,CAAC,IAAI,EAAE,EAAE,CACP,WAAW,CAAC,WAAW;YACvB,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,WAAY,CACvD;QACH,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC;IAE/B,wBAAwB;IACxB,MAAM,YAAY,GAChB,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,KAAI,WAAW,CAAC,aAAa;QAC9C,CAAC,CAAC,WAAW,CAAC,aAAa;QAC3B,CAAC,CAAC,IAAI,CAAC;IAEX,iBAAiB;IACjB,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,uDAAG,WAAW,CAAC,CAAC;IAErC,uCACK,WAAW,KACd,aAAa;QACb,YAAY,IACZ;AACJ,CAAC;AAED,SAAsB,mBAAmB,CAAC,IAAY,EAAE,MAA+B;;QACrF,OAAO,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,CAAC;CAAA;AAED,SAAgB,aAAa,CAAC,IAAY,EAAE,MAA+B;IACzE,OAAO,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,iBAAiB,CAAC;AACxD,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { CheckProfanityResult, Language, SeverityLevel } from '../types/types';
|
|
2
|
-
export interface ProfanityCheckerConfig {
|
|
3
|
-
languages?: Language[];
|
|
4
|
-
allLanguages?: boolean;
|
|
5
|
-
caseSensitive?: boolean;
|
|
6
|
-
wordBoundaries?: boolean;
|
|
7
|
-
customWords?: string[];
|
|
8
|
-
replaceWith?: string;
|
|
9
|
-
severityLevels?: boolean;
|
|
10
|
-
allowObfuscatedMatch?: boolean;
|
|
11
|
-
fuzzyToleranceLevel?: number;
|
|
12
|
-
minSeverity?: SeverityLevel;
|
|
13
|
-
autoReplace?: boolean;
|
|
14
|
-
customActions?: (result: CheckProfanityResult) => void;
|
|
15
|
-
}
|
|
16
|
-
export interface ProfanityCheckResult extends CheckProfanityResult {
|
|
17
|
-
filteredWords: string[];
|
|
18
|
-
autoReplaced: string;
|
|
19
|
-
}
|
|
20
|
-
export type { CheckProfanityResult, Language, SeverityLevel, FilterConfig } from '../types/types';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/core/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
arabic: string[];
|
|
3
|
-
chinese: string[];
|
|
4
|
-
czech: string[];
|
|
5
|
-
danish: string[];
|
|
6
|
-
english: string[];
|
|
7
|
-
esperanto: string[];
|
|
8
|
-
finnish: string[];
|
|
9
|
-
french: string[];
|
|
10
|
-
german: string[];
|
|
11
|
-
hindi: string[];
|
|
12
|
-
hungarian: string[];
|
|
13
|
-
italian: string[];
|
|
14
|
-
japanese: string[];
|
|
15
|
-
korean: string[];
|
|
16
|
-
norwegian: string[];
|
|
17
|
-
persian: string[];
|
|
18
|
-
polish: string[];
|
|
19
|
-
portuguese: string[];
|
|
20
|
-
russian: string[];
|
|
21
|
-
spanish: string[];
|
|
22
|
-
turkish: string[];
|
|
23
|
-
swedish: string[];
|
|
24
|
-
thai: string[];
|
|
25
|
-
};
|
|
26
|
-
export default _default;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const arabic_json_1 = __importDefault(require("@shared/dictionaries/arabic.json"));
|
|
7
|
-
const chinese_json_1 = __importDefault(require("@shared/dictionaries/chinese.json"));
|
|
8
|
-
const czech_json_1 = __importDefault(require("@shared/dictionaries/czech.json"));
|
|
9
|
-
const danish_json_1 = __importDefault(require("@shared/dictionaries/danish.json"));
|
|
10
|
-
const esperanto_json_1 = __importDefault(require("@shared/dictionaries/esperanto.json"));
|
|
11
|
-
const english_json_1 = __importDefault(require("@shared/dictionaries/english.json"));
|
|
12
|
-
const finnish_json_1 = __importDefault(require("@shared/dictionaries/finnish.json"));
|
|
13
|
-
const german_json_1 = __importDefault(require("@shared/dictionaries/german.json"));
|
|
14
|
-
const hindi_json_1 = __importDefault(require("@shared/dictionaries/hindi.json"));
|
|
15
|
-
const hungarian_json_1 = __importDefault(require("@shared/dictionaries/hungarian.json"));
|
|
16
|
-
const korean_json_1 = __importDefault(require("@shared/dictionaries/korean.json"));
|
|
17
|
-
const Norwegian_json_1 = __importDefault(require("@shared/dictionaries/Norwegian.json"));
|
|
18
|
-
const persian_json_1 = __importDefault(require("@shared/dictionaries/persian.json"));
|
|
19
|
-
const polish_json_1 = __importDefault(require("@shared/dictionaries/polish.json"));
|
|
20
|
-
const portuguese_json_1 = __importDefault(require("@shared/dictionaries/portuguese.json"));
|
|
21
|
-
const russian_json_1 = __importDefault(require("@shared/dictionaries/russian.json"));
|
|
22
|
-
const french_json_1 = __importDefault(require("@shared/dictionaries/french.json"));
|
|
23
|
-
const italian_json_1 = __importDefault(require("@shared/dictionaries/italian.json"));
|
|
24
|
-
const japanese_json_1 = __importDefault(require("@shared/dictionaries/japanese.json"));
|
|
25
|
-
const turkish_json_1 = __importDefault(require("@shared/dictionaries/turkish.json"));
|
|
26
|
-
const spanish_json_1 = __importDefault(require("@shared/dictionaries/spanish.json"));
|
|
27
|
-
const swedish_json_1 = __importDefault(require("@shared/dictionaries/swedish.json"));
|
|
28
|
-
const thai_json_1 = __importDefault(require("@shared/dictionaries/thai.json"));
|
|
29
|
-
exports.default = {
|
|
30
|
-
arabic: arabic_json_1.default.words,
|
|
31
|
-
chinese: chinese_json_1.default.words,
|
|
32
|
-
czech: czech_json_1.default.words,
|
|
33
|
-
danish: danish_json_1.default.words,
|
|
34
|
-
english: english_json_1.default.words,
|
|
35
|
-
esperanto: esperanto_json_1.default.words,
|
|
36
|
-
finnish: finnish_json_1.default.words,
|
|
37
|
-
french: french_json_1.default.words,
|
|
38
|
-
german: german_json_1.default.words,
|
|
39
|
-
hindi: hindi_json_1.default.words,
|
|
40
|
-
hungarian: hungarian_json_1.default.words,
|
|
41
|
-
italian: italian_json_1.default.words,
|
|
42
|
-
japanese: japanese_json_1.default.words,
|
|
43
|
-
korean: korean_json_1.default.words,
|
|
44
|
-
norwegian: Norwegian_json_1.default.words,
|
|
45
|
-
persian: persian_json_1.default.words,
|
|
46
|
-
polish: polish_json_1.default.words,
|
|
47
|
-
portuguese: portuguese_json_1.default.words,
|
|
48
|
-
russian: russian_json_1.default.words,
|
|
49
|
-
spanish: spanish_json_1.default.words,
|
|
50
|
-
turkish: turkish_json_1.default.words,
|
|
51
|
-
swedish: swedish_json_1.default.words,
|
|
52
|
-
thai: thai_json_1.default.words,
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=dictionary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../../../../../src/data/dictionary.ts"],"names":[],"mappings":";;;;;AAAA,mFAAsD;AACtD,qFAAwD;AACxD,iFAAoD;AACpD,mFAAsD;AACtD,yFAA4D;AAC5D,qFAAwD;AACxD,qFAAwD;AACxD,mFAAsD;AACtD,iFAAoD;AACpD,yFAA4D;AAC5D,mFAAsD;AACtD,yFAA4D;AAC5D,qFAAwD;AACxD,mFAAsD;AACtD,2FAA8D;AAC9D,qFAAwD;AACxD,mFAAsD;AACtD,qFAAwD;AACxD,uFAA0D;AAC1D,qFAAwD;AACxD,qFAAwD;AACxD,qFAAwD;AACxD,+EAAkD;AAClD,kBAAe;IACb,MAAM,EAAE,qBAAM,CAAC,KAAK;IACpB,OAAO,EAAE,sBAAO,CAAC,KAAK;IACtB,KAAK,EAAE,oBAAK,CAAC,KAAK;IAClB,MAAM,EAAE,qBAAM,CAAC,KAAK;IACpB,OAAO,EAAE,sBAAO,CAAC,KAAK;IACtB,SAAS,EAAE,wBAAS,CAAC,KAAK;IAC1B,OAAO,EAAE,sBAAO,CAAC,KAAK;IACtB,MAAM,EAAE,qBAAM,CAAC,KAAK;IACpB,MAAM,EAAE,qBAAM,CAAC,KAAK;IACpB,KAAK,EAAE,oBAAK,CAAC,KAAK;IAClB,SAAS,EAAE,wBAAS,CAAC,KAAK;IAC1B,OAAO,EAAE,sBAAO,CAAC,KAAK;IACtB,QAAQ,EAAE,uBAAQ,CAAC,KAAK;IACxB,MAAM,EAAE,qBAAM,CAAC,KAAK;IACpB,SAAS,EAAE,wBAAS,CAAC,KAAK;IAC1B,OAAO,EAAE,sBAAO,CAAC,KAAK;IACtB,MAAM,EAAE,qBAAM,CAAC,KAAK;IACpB,UAAU,EAAE,yBAAU,CAAC,KAAK;IAC5B,OAAO,EAAE,sBAAO,CAAC,KAAK;IACtB,OAAO,EAAE,sBAAO,CAAC,KAAK;IACtB,OAAO,EAAE,sBAAO,CAAC,KAAK;IACtB,OAAO,EAAE,sBAAO,CAAC,KAAK;IACtB,IAAI,EAAE,mBAAI,CAAC,KAAK;CACjB,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { CheckProfanityResult, SeverityLevel, FilterConfig } from '../types/types';
|
|
2
|
-
export type { FilterConfig };
|
|
3
|
-
declare class Filter {
|
|
4
|
-
private words;
|
|
5
|
-
private caseSensitive;
|
|
6
|
-
private wordBoundaries;
|
|
7
|
-
private replaceWith?;
|
|
8
|
-
private severityLevels;
|
|
9
|
-
private ignoreWords;
|
|
10
|
-
private logProfanity;
|
|
11
|
-
private allowObfuscatedMatch;
|
|
12
|
-
private fuzzyToleranceLevel;
|
|
13
|
-
private enableContextAware;
|
|
14
|
-
private contextWindow;
|
|
15
|
-
private confidenceThreshold;
|
|
16
|
-
private contextAnalyzer?;
|
|
17
|
-
private primaryLanguage;
|
|
18
|
-
constructor(config?: FilterConfig);
|
|
19
|
-
private debugLog;
|
|
20
|
-
private normalizeObfuscated;
|
|
21
|
-
private getRegex;
|
|
22
|
-
private isFuzzyToleranceMatch;
|
|
23
|
-
private evaluateSeverity;
|
|
24
|
-
isProfane(value: string): boolean;
|
|
25
|
-
matches(word: string): boolean;
|
|
26
|
-
checkProfanity(text: string): CheckProfanityResult;
|
|
27
|
-
checkProfanityWithMinSeverity(text: string, minSeverity?: SeverityLevel): {
|
|
28
|
-
filteredWords: string[];
|
|
29
|
-
result: CheckProfanityResult;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export { Filter };
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Filter = void 0;
|
|
7
|
-
const dictionary_1 = __importDefault(require("../data/dictionary"));
|
|
8
|
-
const types_1 = require("../types/types");
|
|
9
|
-
const contextAnalyzer_1 = require("../nlp/contextAnalyzer");
|
|
10
|
-
class Filter {
|
|
11
|
-
constructor(config) {
|
|
12
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
13
|
-
const defaultLanguage = 'english';
|
|
14
|
-
this.enableContextAware = (_a = config === null || config === void 0 ? void 0 : config.enableContextAware) !== null && _a !== void 0 ? _a : false;
|
|
15
|
-
this.contextWindow = (_b = config === null || config === void 0 ? void 0 : config.contextWindow) !== null && _b !== void 0 ? _b : 3;
|
|
16
|
-
this.confidenceThreshold = (_c = config === null || config === void 0 ? void 0 : config.confidenceThreshold) !== null && _c !== void 0 ? _c : 0.7;
|
|
17
|
-
this.primaryLanguage = ((_d = config === null || config === void 0 ? void 0 : config.languages) === null || _d === void 0 ? void 0 : _d[0]) || defaultLanguage;
|
|
18
|
-
if (this.enableContextAware) {
|
|
19
|
-
this.contextAnalyzer = new contextAnalyzer_1.ContextAnalyzer({
|
|
20
|
-
contextWindow: this.contextWindow,
|
|
21
|
-
language: this.primaryLanguage,
|
|
22
|
-
domainWhitelists: ((_e = config === null || config === void 0 ? void 0 : config.domainWhitelists) === null || _e === void 0 ? void 0 : _e[this.primaryLanguage]) || []
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
let words = [];
|
|
26
|
-
this.caseSensitive = (_f = config === null || config === void 0 ? void 0 : config.caseSensitive) !== null && _f !== void 0 ? _f : false;
|
|
27
|
-
this.allowObfuscatedMatch = (_g = config === null || config === void 0 ? void 0 : config.allowObfuscatedMatch) !== null && _g !== void 0 ? _g : false;
|
|
28
|
-
this.wordBoundaries = (_h = config === null || config === void 0 ? void 0 : config.wordBoundaries) !== null && _h !== void 0 ? _h : !this.allowObfuscatedMatch;
|
|
29
|
-
this.replaceWith = config === null || config === void 0 ? void 0 : config.replaceWith;
|
|
30
|
-
this.severityLevels = (_j = config === null || config === void 0 ? void 0 : config.severityLevels) !== null && _j !== void 0 ? _j : false;
|
|
31
|
-
this.ignoreWords = new Set(((_k = config === null || config === void 0 ? void 0 : config.ignoreWords) === null || _k === void 0 ? void 0 : _k.map((word) => word.toLowerCase())) || []);
|
|
32
|
-
this.logProfanity = (_l = config === null || config === void 0 ? void 0 : config.logProfanity) !== null && _l !== void 0 ? _l : false;
|
|
33
|
-
this.fuzzyToleranceLevel = (_m = config === null || config === void 0 ? void 0 : config.fuzzyToleranceLevel) !== null && _m !== void 0 ? _m : 0.8;
|
|
34
|
-
if (config === null || config === void 0 ? void 0 : config.allLanguages) {
|
|
35
|
-
for (const lang in dictionary_1.default) {
|
|
36
|
-
if (dictionary_1.default.hasOwnProperty(lang)) {
|
|
37
|
-
words = [...words, ...dictionary_1.default[lang]];
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
const languages = (config === null || config === void 0 ? void 0 : config.languages) || ['english'];
|
|
43
|
-
const languagesChecks = new Set(languages);
|
|
44
|
-
languagesChecks.forEach((lang) => {
|
|
45
|
-
words = [...words, ...dictionary_1.default[lang]];
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
if (config === null || config === void 0 ? void 0 : config.customWords) {
|
|
49
|
-
words = [...words, ...config.customWords];
|
|
50
|
-
}
|
|
51
|
-
this.words = new Map(words.map((word) => [word.toLowerCase(), 1]));
|
|
52
|
-
}
|
|
53
|
-
debugLog(...args) {
|
|
54
|
-
if (this.logProfanity) {
|
|
55
|
-
console.log('[glin-profanity]', ...args);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
normalizeObfuscated(text) {
|
|
59
|
-
let normalized = text.replace(/([a-zA-Z])\1{1,}/g, '$1$1');
|
|
60
|
-
const charMap = {
|
|
61
|
-
'@': 'a',
|
|
62
|
-
$: 's',
|
|
63
|
-
'!': 'i',
|
|
64
|
-
'1': 'i',
|
|
65
|
-
'*': '',
|
|
66
|
-
};
|
|
67
|
-
normalized = normalized.replace(/[@$!1*]/g, (m) => charMap[m] || m);
|
|
68
|
-
return normalized;
|
|
69
|
-
}
|
|
70
|
-
getRegex(word) {
|
|
71
|
-
const flags = this.caseSensitive ? 'g' : 'gi';
|
|
72
|
-
const escapedWord = word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
73
|
-
const boundary = this.wordBoundaries ? '\\b' : '';
|
|
74
|
-
return new RegExp(`${boundary}${escapedWord}${boundary}`, flags);
|
|
75
|
-
}
|
|
76
|
-
isFuzzyToleranceMatch(word, text) {
|
|
77
|
-
const simplifiedText = text.toLowerCase().replace(/[^a-z]/g, '');
|
|
78
|
-
const simplifiedWord = word.toLowerCase();
|
|
79
|
-
let matchCount = 0;
|
|
80
|
-
let index = 0;
|
|
81
|
-
for (let i = 0; i < simplifiedText.length; i++) {
|
|
82
|
-
if (simplifiedText[i] === simplifiedWord[index]) {
|
|
83
|
-
matchCount++;
|
|
84
|
-
index++;
|
|
85
|
-
if (index === simplifiedWord.length)
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
const score = matchCount / simplifiedWord.length;
|
|
90
|
-
return score >= this.fuzzyToleranceLevel;
|
|
91
|
-
}
|
|
92
|
-
evaluateSeverity(word, text) {
|
|
93
|
-
if (this.wordBoundaries && this.getRegex(word).test(text)) {
|
|
94
|
-
return types_1.SeverityLevel.EXACT;
|
|
95
|
-
}
|
|
96
|
-
if (this.getRegex(word).test(text))
|
|
97
|
-
return types_1.SeverityLevel.EXACT;
|
|
98
|
-
if (this.isFuzzyToleranceMatch(word, text))
|
|
99
|
-
return types_1.SeverityLevel.FUZZY;
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
|
-
isProfane(value) {
|
|
103
|
-
let input = this.allowObfuscatedMatch
|
|
104
|
-
? this.normalizeObfuscated(value)
|
|
105
|
-
: value;
|
|
106
|
-
for (const word of this.words.keys()) {
|
|
107
|
-
if (!this.ignoreWords.has(word.toLowerCase()) &&
|
|
108
|
-
this.evaluateSeverity(word, input) !== undefined) {
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
matches(word) {
|
|
115
|
-
return this.isProfane(word);
|
|
116
|
-
}
|
|
117
|
-
checkProfanity(text) {
|
|
118
|
-
// Backward compatibility: if not context-aware, run old logic
|
|
119
|
-
if (!this.enableContextAware) {
|
|
120
|
-
let input = this.allowObfuscatedMatch
|
|
121
|
-
? this.normalizeObfuscated(text)
|
|
122
|
-
: text;
|
|
123
|
-
input = input.toLowerCase();
|
|
124
|
-
const profaneWords = [];
|
|
125
|
-
const severityMap = {};
|
|
126
|
-
for (const dictWord of this.words.keys()) {
|
|
127
|
-
if (this.ignoreWords.has(dictWord.toLowerCase()))
|
|
128
|
-
continue;
|
|
129
|
-
const severity = this.evaluateSeverity(dictWord, input);
|
|
130
|
-
if (severity !== undefined) {
|
|
131
|
-
const regex = this.getRegex(dictWord);
|
|
132
|
-
let match;
|
|
133
|
-
while ((match = regex.exec(input)) !== null) {
|
|
134
|
-
profaneWords.push(match[0]);
|
|
135
|
-
if (severityMap[match[0]] === undefined) {
|
|
136
|
-
severityMap[match[0]] = severity;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
let processedText = text;
|
|
142
|
-
if (this.replaceWith && profaneWords.length > 0) {
|
|
143
|
-
const uniqueWords = Array.from(new Set(profaneWords));
|
|
144
|
-
for (const word of uniqueWords) {
|
|
145
|
-
const escaped = word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
146
|
-
const replacementRegex = this.wordBoundaries
|
|
147
|
-
? new RegExp(`\\b${escaped}\\b`, 'gi')
|
|
148
|
-
: new RegExp(escaped, 'gi');
|
|
149
|
-
processedText = processedText.replace(replacementRegex, this.replaceWith);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return {
|
|
153
|
-
containsProfanity: profaneWords.length > 0,
|
|
154
|
-
profaneWords: Array.from(new Set(profaneWords)),
|
|
155
|
-
processedText: this.replaceWith ? processedText : undefined,
|
|
156
|
-
severityMap: this.severityLevels && Object.keys(severityMap).length > 0
|
|
157
|
-
? severityMap
|
|
158
|
-
: undefined,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
// Context-aware path
|
|
162
|
-
let input = this.allowObfuscatedMatch
|
|
163
|
-
? this.normalizeObfuscated(text)
|
|
164
|
-
: text;
|
|
165
|
-
input = input.toLowerCase();
|
|
166
|
-
const originalText = text;
|
|
167
|
-
const profaneWords = [];
|
|
168
|
-
const severityMap = {};
|
|
169
|
-
const matches = [];
|
|
170
|
-
for (const dictWord of this.words.keys()) {
|
|
171
|
-
if (this.ignoreWords.has(dictWord.toLowerCase()))
|
|
172
|
-
continue;
|
|
173
|
-
const severity = this.evaluateSeverity(dictWord, input);
|
|
174
|
-
if (severity !== undefined) {
|
|
175
|
-
const regex = this.getRegex(dictWord);
|
|
176
|
-
let match;
|
|
177
|
-
while ((match = regex.exec(input)) !== null) {
|
|
178
|
-
const matchedWord = match[0];
|
|
179
|
-
const matchIndex = match.index;
|
|
180
|
-
const matchObj = {
|
|
181
|
-
word: matchedWord,
|
|
182
|
-
index: matchIndex,
|
|
183
|
-
severity: severity
|
|
184
|
-
};
|
|
185
|
-
if (this.enableContextAware && this.contextAnalyzer) {
|
|
186
|
-
const contextResult = this.contextAnalyzer.analyzeContext(originalText, matchedWord, matchIndex);
|
|
187
|
-
matchObj.contextScore = contextResult.contextScore;
|
|
188
|
-
matchObj.reason = contextResult.reason;
|
|
189
|
-
matchObj.isWhitelisted = contextResult.isWhitelisted;
|
|
190
|
-
if (contextResult.isWhitelisted || (contextResult.contextScore > this.confidenceThreshold)) {
|
|
191
|
-
continue;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
profaneWords.push(matchedWord);
|
|
195
|
-
if (severityMap[matchedWord] === undefined) {
|
|
196
|
-
severityMap[matchedWord] = severity;
|
|
197
|
-
}
|
|
198
|
-
matches.push(matchObj);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
if (profaneWords.length > 0) {
|
|
203
|
-
this.debugLog('Detected:', profaneWords);
|
|
204
|
-
}
|
|
205
|
-
let processedText = text;
|
|
206
|
-
if (this.replaceWith && profaneWords.length > 0) {
|
|
207
|
-
const uniqueWords = Array.from(new Set(profaneWords));
|
|
208
|
-
for (const word of uniqueWords) {
|
|
209
|
-
const escaped = word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
210
|
-
const replacementRegex = this.wordBoundaries
|
|
211
|
-
? new RegExp(`\\b${escaped}\\b`, 'gi')
|
|
212
|
-
: new RegExp(escaped, 'gi');
|
|
213
|
-
processedText = processedText.replace(replacementRegex, this.replaceWith);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
let contextScore;
|
|
217
|
-
if (this.enableContextAware && matches.length > 0) {
|
|
218
|
-
const totalScore = matches.reduce((sum, match) => sum + (match.contextScore || 0.5), 0);
|
|
219
|
-
contextScore = totalScore / matches.length;
|
|
220
|
-
}
|
|
221
|
-
return {
|
|
222
|
-
containsProfanity: profaneWords.length > 0,
|
|
223
|
-
profaneWords: Array.from(new Set(profaneWords)),
|
|
224
|
-
processedText: this.replaceWith ? processedText : undefined,
|
|
225
|
-
severityMap: this.severityLevels && Object.keys(severityMap).length > 0 ? severityMap : undefined,
|
|
226
|
-
matches: matches.length > 0 ? matches : undefined,
|
|
227
|
-
contextScore,
|
|
228
|
-
reason: matches.length > 0 ?
|
|
229
|
-
`Found ${matches.length} potential profanity matches` :
|
|
230
|
-
'No profanity detected'
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
checkProfanityWithMinSeverity(text, minSeverity = types_1.SeverityLevel.EXACT) {
|
|
234
|
-
const result = this.checkProfanity(text);
|
|
235
|
-
const filteredWords = result.severityMap && result.profaneWords.length > 0
|
|
236
|
-
? result.profaneWords.filter((word) => {
|
|
237
|
-
var _a;
|
|
238
|
-
const severity = (_a = result.severityMap) === null || _a === void 0 ? void 0 : _a[word];
|
|
239
|
-
return typeof severity === 'number' && severity >= minSeverity;
|
|
240
|
-
})
|
|
241
|
-
: [];
|
|
242
|
-
return { filteredWords, result };
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
exports.Filter = Filter;
|
|
246
|
-
//# sourceMappingURL=Filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../../../../../src/filters/Filter.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA4C;AAC5C,0CAAoG;AACpG,4DAAyD;AAIzD,MAAM,MAAM;IAiBV,YAAY,MAAqB;;QAC/B,MAAM,eAAe,GAAa,SAAS,CAAC;QAC5C,IAAI,CAAC,kBAAkB,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,kBAAkB,mCAAI,KAAK,CAAC;QAC9D,IAAI,CAAC,aAAa,GAAG,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CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,aAAa,GACjB,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;YAClD,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;;gBAClC,MAAM,QAAQ,GAAG,MAAA,MAAM,CAAC,WAAW,0CAAG,IAAI,CAAC,CAAC;gBAC5C,OAAO,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,IAAI,WAAW,CAAC;YACjE,CAAC,CAAC;YACJ,CAAC,CAAC,EAAE,CAAC;QAET,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;IACnC,CAAC;CACF;AAEQ,wBAAM"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ProfanityCheckerConfig, ProfanityCheckResult } from '../core/types';
|
|
2
|
-
import type { CheckProfanityResult } from '../types/types';
|
|
3
|
-
export type { ProfanityCheckerConfig };
|
|
4
|
-
export declare const useProfanityChecker: (config?: ProfanityCheckerConfig) => {
|
|
5
|
-
result: CheckProfanityResult;
|
|
6
|
-
checkText: (text: string) => ProfanityCheckResult;
|
|
7
|
-
checkTextAsync: (text: string) => Promise<ProfanityCheckResult>;
|
|
8
|
-
reset: () => void;
|
|
9
|
-
isDirty: boolean;
|
|
10
|
-
isWordProfane: (word: string) => boolean;
|
|
11
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.useProfanityChecker = void 0;
|
|
13
|
-
const react_1 = require("react");
|
|
14
|
-
const core_1 = require("../core");
|
|
15
|
-
const useProfanityChecker = (config) => {
|
|
16
|
-
var _a;
|
|
17
|
-
const [result, setResult] = (0, react_1.useState)(null);
|
|
18
|
-
const checkText = (0, react_1.useCallback)((text) => {
|
|
19
|
-
const checkResult = (0, core_1.checkProfanity)(text, config);
|
|
20
|
-
setResult(checkResult);
|
|
21
|
-
return checkResult;
|
|
22
|
-
}, [config]);
|
|
23
|
-
const checkTextAsync = (0, react_1.useCallback)((text) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
-
const checkResult = yield (0, core_1.checkProfanityAsync)(text, config);
|
|
25
|
-
setResult(checkResult);
|
|
26
|
-
return checkResult;
|
|
27
|
-
}), [config]);
|
|
28
|
-
const isWordProfaneCallback = (0, react_1.useCallback)((word) => {
|
|
29
|
-
return (0, core_1.isWordProfane)(word, config);
|
|
30
|
-
}, [config]);
|
|
31
|
-
const reset = (0, react_1.useCallback)(() => setResult(null), []);
|
|
32
|
-
return {
|
|
33
|
-
result,
|
|
34
|
-
checkText,
|
|
35
|
-
checkTextAsync,
|
|
36
|
-
reset,
|
|
37
|
-
isDirty: (_a = result === null || result === void 0 ? void 0 : result.containsProfanity) !== null && _a !== void 0 ? _a : false,
|
|
38
|
-
isWordProfane: isWordProfaneCallback,
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
exports.useProfanityChecker = useProfanityChecker;
|
|
42
|
-
//# sourceMappingURL=useProfanityChecker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useProfanityChecker.js","sourceRoot":"","sources":["../../../../../../src/hooks/useProfanityChecker.ts"],"names":[],"mappings":";;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,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Glin-Profanity: Lightweight and efficient profanity detection and filtering.
|
|
3
|
-
*
|
|
4
|
-
* Provides multi-language support, context-aware filtering, and customizable
|
|
5
|
-
* configurations for detecting and filtering profane language in text inputs.
|
|
6
|
-
*/
|
|
7
|
-
export { checkProfanity, checkProfanityAsync, isWordProfane } from './core';
|
|
8
|
-
export type { ProfanityCheckerConfig, ProfanityCheckResult } from './core/types';
|
|
9
|
-
export { useProfanityChecker } from './hooks/useProfanityChecker';
|
|
10
|
-
export { Filter } from './filters/Filter';
|
|
11
|
-
export { SeverityLevel } from './types/types';
|
|
12
|
-
export type { Language, CheckProfanityResult, FilterConfig, FilteredProfanityResult, Match, ContextAwareConfig } from './types/types';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Glin-Profanity: Lightweight and efficient profanity detection and filtering.
|
|
4
|
-
*
|
|
5
|
-
* Provides multi-language support, context-aware filtering, and customizable
|
|
6
|
-
* configurations for detecting and filtering profane language in text inputs.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.SeverityLevel = exports.Filter = exports.useProfanityChecker = exports.isWordProfane = exports.checkProfanityAsync = exports.checkProfanity = void 0;
|
|
10
|
-
// Core API (framework-agnostic)
|
|
11
|
-
var core_1 = require("./core");
|
|
12
|
-
Object.defineProperty(exports, "checkProfanity", { enumerable: true, get: function () { return core_1.checkProfanity; } });
|
|
13
|
-
Object.defineProperty(exports, "checkProfanityAsync", { enumerable: true, get: function () { return core_1.checkProfanityAsync; } });
|
|
14
|
-
Object.defineProperty(exports, "isWordProfane", { enumerable: true, get: function () { return core_1.isWordProfane; } });
|
|
15
|
-
// React-specific
|
|
16
|
-
var useProfanityChecker_1 = require("./hooks/useProfanityChecker");
|
|
17
|
-
Object.defineProperty(exports, "useProfanityChecker", { enumerable: true, get: function () { return useProfanityChecker_1.useProfanityChecker; } });
|
|
18
|
-
// Advanced/Low-level
|
|
19
|
-
var Filter_1 = require("./filters/Filter");
|
|
20
|
-
Object.defineProperty(exports, "Filter", { enumerable: true, get: function () { return Filter_1.Filter; } });
|
|
21
|
-
// Legacy types (maintain compatibility)
|
|
22
|
-
var types_1 = require("./types/types");
|
|
23
|
-
Object.defineProperty(exports, "SeverityLevel", { enumerable: true, get: function () { return types_1.SeverityLevel; } });
|
|
24
|
-
//# sourceMappingURL=index.js.map
|