glin-profanity 1.1.2 → 1.1.4

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.
Files changed (94) hide show
  1. package/lib/data/Norwegian.json +17 -0
  2. package/lib/data/arabic.json +157 -0
  3. package/lib/data/chinese.json +298 -0
  4. package/lib/data/czech.json +45 -0
  5. package/lib/data/danish.json +24 -0
  6. package/lib/data/dictionary.d.ts +26 -0
  7. package/lib/data/dictionary.d.ts.map +1 -0
  8. package/{src/data/dictionary.ts → lib/data/dictionary.js} +23 -22
  9. package/lib/data/dictionary.js.map +1 -0
  10. package/lib/data/english.json +382 -0
  11. package/lib/data/esperanto.json +41 -0
  12. package/lib/data/finnish.json +134 -0
  13. package/lib/data/french.json +99 -0
  14. package/lib/data/german.json +69 -0
  15. package/lib/data/hindi.json +100 -0
  16. package/lib/data/hungarian.json +100 -0
  17. package/lib/data/italian.json +184 -0
  18. package/lib/data/japanese.json +189 -0
  19. package/lib/data/korean.json +76 -0
  20. package/lib/data/persian.json +49 -0
  21. package/lib/data/polish.json +57 -0
  22. package/lib/data/portuguese.json +78 -0
  23. package/lib/data/russian.json +156 -0
  24. package/lib/data/swedish.json +47 -0
  25. package/lib/data/thai.json +35 -0
  26. package/lib/data/turkish.json +195 -0
  27. package/lib/filters/Filter.d.ts +27 -0
  28. package/lib/filters/Filter.d.ts.map +1 -0
  29. package/lib/filters/Filter.js +73 -0
  30. package/lib/filters/Filter.js.map +1 -0
  31. package/lib/hooks/useProfanityChecker.d.ts +18 -0
  32. package/lib/hooks/useProfanityChecker.d.ts.map +1 -0
  33. package/lib/hooks/useProfanityChecker.js +38 -0
  34. package/lib/hooks/useProfanityChecker.js.map +1 -0
  35. package/{src/index.ts → lib/index.d.ts} +1 -0
  36. package/lib/index.d.ts.map +1 -0
  37. package/lib/index.js +3 -0
  38. package/lib/index.js.map +1 -0
  39. package/lib/types/types.d.ts +10 -0
  40. package/lib/types/types.d.ts.map +1 -0
  41. package/lib/types/types.js +2 -0
  42. package/lib/types/types.js.map +1 -0
  43. package/package.json +26 -55
  44. package/.babelrc +0 -3
  45. package/.eslintrc.json +0 -27
  46. package/.gitattributes +0 -1
  47. package/.github/workflows/dependency-review.yml +0 -39
  48. package/.github/workflows/publish.yml +0 -31
  49. package/.husky/commit-msg +0 -5
  50. package/.husky/post-commit +0 -4
  51. package/.husky/pre-commit +0 -5
  52. package/.nvmrc +0 -1
  53. package/.prettierignore +0 -13
  54. package/.prettierrc +0 -15
  55. package/CODE_OF_CONDUCT.md +0 -80
  56. package/LICENSE +0 -21
  57. package/SECURITY.md +0 -14
  58. package/changelog.config.cjs +0 -89
  59. package/commitlint.config.cjs +0 -138
  60. package/dist/index.html +0 -1
  61. package/dist/index.js +0 -2
  62. package/dist/index.js.LICENSE.txt +0 -11
  63. package/public/index.html +0 -11
  64. package/src/App.tsx +0 -140
  65. package/src/data/Norwegian.json +0 -17
  66. package/src/data/arabic.json +0 -157
  67. package/src/data/chinese.json +0 -298
  68. package/src/data/czech.json +0 -45
  69. package/src/data/danish.json +0 -24
  70. package/src/data/english.json +0 -382
  71. package/src/data/esperanto.json +0 -41
  72. package/src/data/finnish.json +0 -134
  73. package/src/data/french.json +0 -99
  74. package/src/data/german.json +0 -69
  75. package/src/data/hindi.json +0 -100
  76. package/src/data/hungarian.json +0 -100
  77. package/src/data/italian.json +0 -184
  78. package/src/data/japanese.json +0 -189
  79. package/src/data/korean.json +0 -76
  80. package/src/data/persian.json +0 -49
  81. package/src/data/polish.json +0 -57
  82. package/src/data/portuguese.json +0 -78
  83. package/src/data/russian.json +0 -156
  84. package/src/data/spanish.json +0 -72
  85. package/src/data/swedish.json +0 -47
  86. package/src/data/thai.json +0 -35
  87. package/src/data/turkish.json +0 -195
  88. package/src/filters/Filter.ts +0 -102
  89. package/src/hooks/useProfanityChecker.ts +0 -44
  90. package/src/index.d.ts +0 -36
  91. package/src/index.tsx +0 -10
  92. package/src/types/types.ts +0 -30
  93. package/tsconfig.json +0 -27
  94. package/webpack.config.js +0 -37
@@ -0,0 +1,27 @@
1
+ import { Language, CheckProfanityResult } from '../types/types';
2
+ interface FilterConfig {
3
+ languages?: Language[];
4
+ allLanguages?: boolean;
5
+ caseSensitive?: boolean;
6
+ wordBoundaries?: boolean;
7
+ customWords?: string[];
8
+ replaceWith?: string;
9
+ severityLevels?: boolean;
10
+ ignoreWords?: string[];
11
+ logProfanity?: boolean;
12
+ }
13
+ declare class Filter {
14
+ private words;
15
+ private caseSensitive;
16
+ private wordBoundaries;
17
+ private replaceWith?;
18
+ private severityLevels;
19
+ private ignoreWords;
20
+ private logProfanity;
21
+ constructor(config?: FilterConfig);
22
+ private getRegex;
23
+ isProfane(value: string): boolean;
24
+ checkProfanity(text: string): CheckProfanityResult;
25
+ }
26
+ export { Filter };
27
+ //# sourceMappingURL=Filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Filter.d.ts","sourceRoot":"","sources":["../../src/filters/Filter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,cAAM,MAAM;IACV,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,YAAY,CAAU;gBAElB,MAAM,CAAC,EAAE,YAAY;IAgCjC,OAAO,CAAC,QAAQ;IAMhB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAOjC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB;CA8BnD;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,73 @@
1
+ import dictionary from '../data/dictionary';
2
+ class Filter {
3
+ constructor(config) {
4
+ var _a, _b, _c, _d, _e;
5
+ let words = [];
6
+ this.caseSensitive = (_a = config === null || config === void 0 ? void 0 : config.caseSensitive) !== null && _a !== void 0 ? _a : false;
7
+ this.wordBoundaries = (_b = config === null || config === void 0 ? void 0 : config.wordBoundaries) !== null && _b !== void 0 ? _b : true;
8
+ this.replaceWith = config === null || config === void 0 ? void 0 : config.replaceWith;
9
+ this.severityLevels = (_c = config === null || config === void 0 ? void 0 : config.severityLevels) !== null && _c !== void 0 ? _c : false;
10
+ this.ignoreWords = new Set(((_d = config === null || config === void 0 ? void 0 : config.ignoreWords) === null || _d === void 0 ? void 0 : _d.map(word => word.toLowerCase())) || []);
11
+ this.logProfanity = (_e = config === null || config === void 0 ? void 0 : config.logProfanity) !== null && _e !== void 0 ? _e : false;
12
+ if (config === null || config === void 0 ? void 0 : config.allLanguages) {
13
+ for (const lang in dictionary) {
14
+ if (dictionary.hasOwnProperty(lang)) {
15
+ words = [...words, ...dictionary[lang]];
16
+ }
17
+ }
18
+ }
19
+ else {
20
+ const languages = (config === null || config === void 0 ? void 0 : config.languages) || ['english'];
21
+ const languagesChecks = new Set(languages);
22
+ if (languagesChecks.size !== 0) {
23
+ languagesChecks.forEach(lang => {
24
+ words = [...words, ...dictionary[lang]];
25
+ });
26
+ }
27
+ }
28
+ if (config === null || config === void 0 ? void 0 : config.customWords) {
29
+ words = [...words, ...config.customWords];
30
+ }
31
+ this.words = new Map(words.map(word => [word, 1])); // Default severity level is 1
32
+ }
33
+ getRegex(word) {
34
+ const flags = this.caseSensitive ? 'g' : 'gi';
35
+ const boundary = this.wordBoundaries ? '\\b' : '';
36
+ return new RegExp(`${boundary}${word.replace(/(\W)/g, '\\$1')}${boundary}`, flags);
37
+ }
38
+ isProfane(value) {
39
+ for (const word of this.words.keys()) {
40
+ if (!this.ignoreWords.has(word.toLowerCase()) && this.getRegex(word).test(value))
41
+ return true;
42
+ }
43
+ return false;
44
+ }
45
+ checkProfanity(text) {
46
+ const words = text.split(/\s+/);
47
+ const profaneWords = [];
48
+ const severityMap = {};
49
+ for (const word of words) {
50
+ if (this.words.has(word.toLowerCase()) && !this.ignoreWords.has(word.toLowerCase())) {
51
+ profaneWords.push(word);
52
+ severityMap[word] = this.words.get(word.toLowerCase());
53
+ }
54
+ }
55
+ if (this.logProfanity && profaneWords.length > 0) {
56
+ console.log(`Profane words detected: ${profaneWords.join(', ')}`);
57
+ }
58
+ let processedText = text;
59
+ if (this.replaceWith) {
60
+ for (const word of profaneWords) {
61
+ processedText = processedText.replace(this.getRegex(word), this.replaceWith);
62
+ }
63
+ }
64
+ return {
65
+ containsProfanity: profaneWords.length > 0,
66
+ profaneWords,
67
+ processedText: this.replaceWith ? processedText : undefined,
68
+ severityMap: this.severityLevels ? severityMap : undefined,
69
+ };
70
+ }
71
+ }
72
+ export { Filter };
73
+ //# sourceMappingURL=Filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../src/filters/Filter.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAe5C,MAAM,MAAM;IASV,YAAY,MAAqB;;QAC/B,IAAI,KAAK,GAAa,EAAE,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,mCAAI,KAAK,CAAC;QACpD,IAAI,CAAC,cAAc,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN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E,CAAC;YACzB,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;gBACpF,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACxB,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAE,CAAC;YAC1D,CAAC;QACH,CAAC;QAED,IAAI,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjD,OAAO,CAAC,GAAG,CAAC,2BAA2B,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,IAAI,aAAa,GAAG,IAAI,CAAC;QACzB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;gBAChC,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;YAC/E,CAAC;QACH,CAAC;QAED,OAAO;YACL,iBAAiB,EAAE,YAAY,CAAC,MAAM,GAAG,CAAC;YAC1C,YAAY;YACZ,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;YAC3D,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;SAC3D,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { CheckProfanityResult, Language } from '../types/types';
2
+ interface ProfanityCheckerConfig {
3
+ languages?: Language[];
4
+ allLanguages?: boolean;
5
+ caseSensitive?: boolean;
6
+ wordBoundaries?: boolean;
7
+ customWords?: string[];
8
+ replaceWith?: string;
9
+ severityLevels?: boolean;
10
+ customActions?: (result: CheckProfanityResult) => void;
11
+ }
12
+ export declare const useProfanityChecker: (config?: ProfanityCheckerConfig) => {
13
+ result: CheckProfanityResult;
14
+ checkText: (text: string) => void;
15
+ checkTextAsync: (text: string) => Promise<CheckProfanityResult>;
16
+ };
17
+ export {};
18
+ //# sourceMappingURL=useProfanityChecker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useProfanityChecker.d.ts","sourceRoot":"","sources":["../../src/hooks/useProfanityChecker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEhE,UAAU,sBAAsB;IAC9B,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACxD;AAED,eAAO,MAAM,mBAAmB,YAAa,sBAAsB;;sBAIxC,MAAM;2BAQK,MAAM;CAgB3C,CAAC"}
@@ -0,0 +1,38 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { useState } from 'react';
11
+ import { Filter } from '../filters/Filter';
12
+ export const useProfanityChecker = (config) => {
13
+ const [result, setResult] = useState(null);
14
+ const filter = new Filter(config);
15
+ const checkText = (text) => {
16
+ const checkResult = filter.checkProfanity(text);
17
+ setResult(checkResult);
18
+ if (config === null || config === void 0 ? void 0 : config.customActions) {
19
+ config.customActions(checkResult);
20
+ }
21
+ };
22
+ const checkTextAsync = (text) => __awaiter(void 0, void 0, void 0, function* () {
23
+ return new Promise((resolve) => {
24
+ const checkResult = filter.checkProfanity(text);
25
+ setResult(checkResult);
26
+ if (config === null || config === void 0 ? void 0 : config.customActions) {
27
+ config.customActions(checkResult);
28
+ }
29
+ resolve(checkResult);
30
+ });
31
+ });
32
+ return {
33
+ result,
34
+ checkText,
35
+ checkTextAsync,
36
+ };
37
+ };
38
+ //# sourceMappingURL=useProfanityChecker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useProfanityChecker.js","sourceRoot":"","sources":["../../src/hooks/useProfanityChecker.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAc3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAA+B,EAAE,EAAE;IACrE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAA8B,IAAI,CAAC,CAAC;IACxE,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAElC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAE;QACjC,MAAM,WAAW,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAChD,SAAS,CAAC,WAAW,CAAC,CAAC;QACvB,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,EAAE,CAAC;YAC1B,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QACpC,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,CAAO,IAAY,EAAE,EAAE;QAC5C,OAAO,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,EAAE;YACnD,MAAM,WAAW,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAChD,SAAS,CAAC,WAAW,CAAC,CAAC;YACvB,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,EAAE,CAAC;gBAC1B,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;YACpC,CAAC;YACD,OAAO,CAAC,WAAW,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;IAEF,OAAO;QACL,MAAM;QACN,SAAS;QACT,cAAc;KACf,CAAC;AACJ,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { Filter } from './filters/Filter';
2
2
  export { useProfanityChecker } from './hooks/useProfanityChecker';
3
3
  export type { Language, CheckProfanityResult } from './types/types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,YAAY,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { Filter } from './filters/Filter';
2
+ export { useProfanityChecker } from './hooks/useProfanityChecker';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,10 @@
1
+ export interface CheckProfanityResult {
2
+ containsProfanity: boolean;
3
+ profaneWords: string[];
4
+ processedText?: string;
5
+ severityMap?: {
6
+ [word: string]: number;
7
+ };
8
+ }
9
+ export type Language = 'arabic' | 'chinese' | 'czech' | 'danish' | 'english' | 'esperanto' | 'finnish' | 'french' | 'german' | 'hindi' | 'hungarian' | 'italian' | 'japanese' | 'korean' | 'norwegian' | 'persian' | 'polish' | 'portuguese' | 'russian' | 'turkish' | 'swedish' | 'thai';
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,oBAAoB;IACnC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC1C;AACD,MAAM,MAAM,QAAQ,GAChB,QAAQ,GACR,SAAS,GACT,OAAO,GACP,QAAQ,GACR,SAAS,GACT,WAAW,GACX,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,WAAW,GACX,SAAS,GACT,UAAU,GACV,QAAQ,GACR,WAAW,GACX,SAAS,GACT,QAAQ,GACR,YAAY,GACZ,SAAS,GACT,SAAS,GACT,SAAS,GACT,MAAM,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,57 +1,28 @@
1
1
  {
2
- "name": "glin-profanity",
3
- "version": "1.1.2",
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
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1",
9
- "start": "webpack serve --mode development",
10
- "build": "webpack --mode production",
11
- "prepare": "husky install",
12
- "commit": "git-cz",
13
- "lint": "eslint ."
14
- },
15
- "repository": {
16
- "type": "git",
17
- "url": "https://github.com/GLINCKER/glin-profanity"
18
- },
19
- "keywords": ["glin-profanity","glincker","glin","profanity"],
20
- "author": "gdsks",
21
- "license": "ISC",
22
- "dependencies": {
23
- "react": "^18.3.1",
24
- "react-dom": "^18.3.1"
25
- },
26
- "devDependencies": {
27
- "@commitlint/cli": "^17.7.1",
28
- "@commitlint/config-conventional": "^17.7.0",
29
- "@babel/core": "^7.25.2",
30
- "@babel/preset-env": "^7.25.2",
31
- "@babel/preset-react": "^7.24.7",
32
- "@babel/preset-typescript": "^7.24.7",
33
- "@types/node": "^22.0.0",
34
- "@types/react": "^18.3.3",
35
- "@types/react-dom": "^18.3.0",
36
- "@typescript-eslint/eslint-plugin": "^7.18.0",
37
- "@typescript-eslint/parser": "^7.18.0",
38
- "babel-loader": "^9.1.3",
39
- "eslint": "^8.57.0",
40
- "eslint-plugin-react": "^7.35.0",
41
- "html-webpack-plugin": "^5.6.0",
42
- "husky": "^8.0.3",
43
- "prettier": "^3.3.3",
44
- "typescript": "^5.5.4",
45
- "webpack": "^5.93.0",
46
- "webpack-cli": "^5.1.4",
47
- "webpack-dev-server": "^5.0.4",
48
- "git-cz": "^4.9.0",
49
- "lint-staged": "^15.2.0"
50
- },
51
- "lint-staged": {
52
- "*.{js,jsx,ts,tsx}": [
53
- "eslint --fix",
54
- "prettier --write"
55
- ]
56
- }
2
+ "name": "glin-profanity",
3
+ "version": "1.1.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
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc -p tsconfig.json"
9
+ },
10
+ "files": [
11
+ "lib"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/GLINCKER/glin-profanity"
16
+ },
17
+ "keywords": [
18
+ "glin-profanity",
19
+ "glincker",
20
+ "glin",
21
+ "profanity"
22
+ ],
23
+ "author": "gdsks",
24
+ "license": "ISC",
25
+ "dependencies": {
26
+ "glin-profanity": "file:"
27
+ }
57
28
  }
package/.babelrc DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"]
3
- }
package/.eslintrc.json DELETED
@@ -1,27 +0,0 @@
1
- {
2
- "parser": "@typescript-eslint/parser",
3
- "extends": [
4
- "eslint:recommended",
5
- "plugin:react/recommended",
6
- "plugin:@typescript-eslint/recommended",
7
- ],
8
- "plugins": ["react", "@typescript-eslint"],
9
- "env": {
10
- "browser": true,
11
- "node": true,
12
- "es6": true
13
- },
14
- "parserOptions": {
15
- "ecmaFeatures": {
16
- "jsx": true
17
- },
18
- "ecmaVersion": 2020,
19
- "sourceType": "module"
20
- },
21
- "settings": {
22
- "react": {
23
- "version": "detect"
24
- }
25
- }
26
- }
27
-
package/.gitattributes DELETED
@@ -1 +0,0 @@
1
- * text=auto
@@ -1,39 +0,0 @@
1
- # Dependency Review Action
2
- #
3
- # This Action will scan dependency manifest files that change as part of a Pull Request,
4
- # surfacing known-vulnerable versions of the packages declared or updated in the PR.
5
- # Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable
6
- # packages will be blocked from merging.
7
- #
8
- # Source repository: https://github.com/actions/dependency-review-action
9
- # Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
10
- name: 'Dependency review'
11
- on:
12
- pull_request:
13
- branches: [ "develop" ]
14
-
15
- # If using a dependency submission action in this workflow this permission will need to be set to:
16
- #
17
- # permissions:
18
- # contents: write
19
- #
20
- # https://docs.github.com/en/enterprise-cloud@latest/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api
21
- permissions:
22
- contents: read
23
- # Write permissions for pull-requests are required for using the `comment-summary-in-pr` option, comment out if you aren't using this option
24
- pull-requests: write
25
-
26
- jobs:
27
- dependency-review:
28
- runs-on: ubuntu-latest
29
- steps:
30
- - name: 'Checkout repository'
31
- uses: actions/checkout@v4
32
- - name: 'Dependency Review'
33
- uses: actions/dependency-review-action@v4
34
- # Commonly enabled options, see https://github.com/actions/dependency-review-action#configuration-options for all available options.
35
- with:
36
- comment-summary-in-pr: always
37
- # fail-on-severity: moderate
38
- # deny-licenses: GPL-1.0-or-later, LGPL-2.0-or-later
39
- # retry-on-snapshot-warnings: true
@@ -1,31 +0,0 @@
1
- name: Publish to npm
2
-
3
- on:
4
- push:
5
- branches:
6
- - release
7
-
8
- jobs:
9
- build-and-publish:
10
- runs-on: ubuntu-latest
11
-
12
- steps:
13
- - name: Checkout repository
14
- uses: actions/checkout@v2
15
-
16
- - name: Setup Node.js
17
- uses: actions/setup-node@v2
18
- with:
19
- node-version: '18'
20
- registry-url: 'https://registry.npmjs.org'
21
-
22
- - name: Install dependencies
23
- run: npm install
24
-
25
- - name: Build project
26
- run: npm run build
27
-
28
- - name: Publish to npm
29
- run: npm publish
30
- env:
31
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/.husky/commit-msg DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- npx --no -- commitlint --edit ${1}
5
- npx --no-install commitlint --edit "$1"
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- git push
package/.husky/pre-commit DELETED
@@ -1,5 +0,0 @@
1
-
2
- #!/usr/bin/env sh
3
- . "$(dirname -- "$0")/_/husky.sh"
4
-
5
- yarn lint-staged
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- v18.20.1
package/.prettierignore DELETED
@@ -1,13 +0,0 @@
1
- # Files to ingore prettier to format
2
-
3
- /dist
4
- /build
5
-
6
- # Eslint files
7
- .eslintignore
8
- .eslintrc.js
9
-
10
- #commit files
11
- changelog.config.js
12
- commitlint.config.js
13
- /.husky
package/.prettierrc DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "doubleQuote": true,
4
- "useTabs": false,
5
- "overrides": [
6
- {
7
- "files": "*.yaml",
8
- "options": {
9
- "tadWidth": 2,
10
- "printWidth": 40,
11
- "singleQuote": true
12
- }
13
- }
14
- ]
15
- }
@@ -1,80 +0,0 @@
1
-
2
- # Contributor Covenant Code of Conduct
3
-
4
- ## Our Pledge
5
-
6
- We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
7
-
8
- We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
9
-
10
- ## Our Standards
11
-
12
- Examples of behavior that contributes to a positive environment for our community include:
13
-
14
- * Demonstrating empathy and kindness toward other people
15
- * Being respectful of differing opinions, viewpoints, and experiences
16
- * Giving and gracefully accepting constructive feedback
17
- * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
18
- * Focusing on what is best not just for us as individuals, but for the overall community
19
-
20
- Examples of unacceptable behavior include:
21
-
22
- * The use of sexualized language or imagery, and sexual attention or advances of any kind
23
- * Trolling, insulting or derogatory comments, and personal or political attacks
24
- * Public or private harassment
25
- * Publishing others’ private information, such as a physical or email address, without their explicit permission
26
- * Other conduct which could reasonably be considered inappropriate in a professional setting
27
-
28
- ## Enforcement Responsibilities
29
-
30
- Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
31
-
32
- Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
33
-
34
- ## Scope
35
-
36
- This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
37
-
38
- ## Enforcement
39
-
40
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [support@glincker.com]. All complaints will be reviewed and investigated promptly and fairly.
41
-
42
- All community leaders are obligated to respect the privacy and security of the reporter of any incident.
43
-
44
- ## Enforcement Guidelines
45
-
46
- Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
47
-
48
- ### 1. Correction
49
-
50
- **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
51
-
52
- **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
53
-
54
- ### 2. Warning
55
-
56
- **Community Impact**: A violation through a single incident or series of actions.
57
-
58
- **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
59
-
60
- ### 3. Temporary Ban
61
-
62
- **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
63
-
64
- **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
65
-
66
- ### 4. Permanent Ban
67
-
68
- **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
69
-
70
- **Consequence**: A permanent ban from any sort of public interaction within the community.
71
-
72
- ## Attribution
73
-
74
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html).
75
-
76
- Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
77
-
78
- For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are available at [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations).
79
-
80
- [homepage]: https://www.contributor-covenant.org
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) Meta Platforms, Inc. and affiliates.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/SECURITY.md DELETED
@@ -1,14 +0,0 @@
1
- # Security Policy
2
-
3
- ## Supported Versions
4
-
5
- We release patches for security vulnerabilities. Which versions are eligible for security updates?
6
-
7
- | Version | Supported |
8
- | ------- | ------------------ |
9
- | 1.x | :white_check_mark: |
10
- | < 1.0 | :x: |
11
-
12
- ## Reporting a Vulnerability
13
-
14
- If you discover a security vulnerability, please open an issue or contact us directly at [gdsks@glincker.com]. We take all security vulnerabilities seriously and will respond promptly to address the issue.