glin-profanity 0.0.1

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 (53) hide show
  1. package/.babelrc +3 -0
  2. package/.eslintrc.json +31 -0
  3. package/.gitattributes +1 -0
  4. package/.github/workflows/dependency-review.yml +39 -0
  5. package/.github/workflows/publish.yml +31 -0
  6. package/.husky/commit-msg +5 -0
  7. package/.husky/post-commit +4 -0
  8. package/.husky/pre-commit +5 -0
  9. package/.nvmrc +1 -0
  10. package/.prettierignore +13 -0
  11. package/.prettierrc +15 -0
  12. package/CODE_OF_CONDUCT.md +80 -0
  13. package/LICENSE +21 -0
  14. package/README.md +136 -0
  15. package/SECURITY.md +14 -0
  16. package/changelog.config.cjs +89 -0
  17. package/commitlint.config.cjs +138 -0
  18. package/dist/bundle.js +2 -0
  19. package/dist/bundle.js.LICENSE.txt +9 -0
  20. package/dist/index.html +1 -0
  21. package/package.json +55 -0
  22. package/public/index.html +11 -0
  23. package/src/App.tsx +46 -0
  24. package/src/data/Norwegian.json +17 -0
  25. package/src/data/arabic.json +157 -0
  26. package/src/data/chinese.json +298 -0
  27. package/src/data/czech.json +45 -0
  28. package/src/data/danish.json +24 -0
  29. package/src/data/dictionary.ts +46 -0
  30. package/src/data/english.json +382 -0
  31. package/src/data/esperanto.json +41 -0
  32. package/src/data/finnish.json +134 -0
  33. package/src/data/french.json +99 -0
  34. package/src/data/german.json +69 -0
  35. package/src/data/hindi.json +100 -0
  36. package/src/data/hungarian.json +100 -0
  37. package/src/data/italian.json +184 -0
  38. package/src/data/japanese.json +189 -0
  39. package/src/data/korean.json +76 -0
  40. package/src/data/persian.json +49 -0
  41. package/src/data/polish.json +57 -0
  42. package/src/data/portuguese.json +78 -0
  43. package/src/data/russian.json +156 -0
  44. package/src/data/spanish.json +72 -0
  45. package/src/data/swedish.json +47 -0
  46. package/src/data/thai.json +35 -0
  47. package/src/data/turkish.json +195 -0
  48. package/src/filters/Filter.ts +58 -0
  49. package/src/hooks/useProfanityChecker.ts +22 -0
  50. package/src/index.ts +3 -0
  51. package/src/types/Language.ts +23 -0
  52. package/tsconfig.json +26 -0
  53. package/webpack.config.js +36 -0
@@ -0,0 +1,22 @@
1
+ import { useState } from 'react';
2
+ import { Filter, CheckProfanityResult } from '../filters/Filter';
3
+ import { Language } from '../types/Language';
4
+
5
+ interface ProfanityCheckerConfig {
6
+ languages?: Language[];
7
+ allLanguages?: boolean;
8
+ }
9
+
10
+ export const useProfanityChecker = (config?: ProfanityCheckerConfig) => {
11
+ const [result, setResult] = useState<CheckProfanityResult | null>(null);
12
+ const filter = new Filter(config);
13
+
14
+ const checkText = (text: string) => {
15
+ setResult(filter.checkProfanity(text));
16
+ };
17
+
18
+ return {
19
+ result,
20
+ checkText
21
+ };
22
+ };
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { Filter, CheckProfanityResult } from './filters/Filter';
2
+ export { useProfanityChecker } from './hooks/useProfanityChecker';
3
+ export type { Language } from './types/Language';
@@ -0,0 +1,23 @@
1
+ export type Language =
2
+ | 'arabic'
3
+ | 'chinese'
4
+ | 'czech'
5
+ | 'danish'
6
+ | 'english'
7
+ | 'esperanto'
8
+ | 'finnish'
9
+ | 'french'
10
+ | 'german'
11
+ | 'hindi'
12
+ | 'hungarian'
13
+ | 'italian'
14
+ | 'japanese'
15
+ | 'korean'
16
+ | 'norwegian'
17
+ | 'persian'
18
+ | 'polish'
19
+ | 'portuguese'
20
+ | 'russian'
21
+ | 'turkish'
22
+ | 'swedish'
23
+ | 'thai';
package/tsconfig.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES5",
4
+ "module": "CommonJS",
5
+ "lib": [
6
+ "dom",
7
+ "es2015"
8
+ ],
9
+ "jsx": "react",
10
+ "outDir": "./dist",
11
+ "rootDir": "./src",
12
+ "strict": true,
13
+ "moduleResolution": "node",
14
+ "esModuleInterop": true,
15
+ "skipLibCheck": true,
16
+ "resolveJsonModule": true,
17
+ "allowSyntheticDefaultImports": true
18
+ },
19
+ "include": [
20
+ "src"
21
+ ],
22
+ "exclude": [
23
+ "node_modules",
24
+ "dist"
25
+ ]
26
+ }
@@ -0,0 +1,36 @@
1
+ const path = require('path');
2
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
3
+
4
+ module.exports = {
5
+ entry: './src/index.ts',
6
+ output: {
7
+ path: path.resolve(__dirname, 'dist'),
8
+ filename: 'bundle.js'
9
+ },
10
+ resolve: {
11
+ extensions: ['.ts', '.tsx', '.js']
12
+ },
13
+ module: {
14
+ rules: [
15
+ {
16
+ test: /\.tsx?$/,
17
+ exclude: /node_modules/,
18
+ use: {
19
+ loader: 'babel-loader'
20
+ }
21
+ }
22
+ ]
23
+ },
24
+ plugins: [
25
+ new HtmlWebpackPlugin({
26
+ template: './public/index.html'
27
+ })
28
+ ],
29
+ devServer: {
30
+ static: {
31
+ directory: path.join(__dirname, 'dist')
32
+ },
33
+ compress: true,
34
+ port: 9000
35
+ }
36
+ };