glin-profanity 3.2.0 → 3.2.2

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 (65) hide show
  1. package/dist/{types-Dj5vaoch.d.cts → Filter-BGcyIAvO.d.ts} +2 -162
  2. package/dist/{types-Dj5vaoch.d.ts → Filter-D34Wsmrj.d.cts} +2 -162
  3. package/dist/frameworks/index.cjs +5257 -0
  4. package/dist/frameworks/index.d.cts +2 -0
  5. package/dist/frameworks/index.d.ts +2 -0
  6. package/dist/frameworks/index.js +5252 -0
  7. package/dist/frameworks/nextjs.cjs +5257 -0
  8. package/dist/frameworks/nextjs.d.cts +173 -0
  9. package/dist/frameworks/nextjs.d.ts +173 -0
  10. package/dist/frameworks/nextjs.js +5252 -0
  11. package/dist/index.cjs +0 -28
  12. package/dist/index.d.cts +5 -29
  13. package/dist/index.d.ts +5 -29
  14. package/dist/index.js +1 -28
  15. package/dist/integrations/index.cjs +6110 -0
  16. package/dist/integrations/index.d.cts +5 -0
  17. package/dist/integrations/index.d.ts +5 -0
  18. package/dist/integrations/index.js +6082 -0
  19. package/dist/integrations/langchain.cjs +5252 -0
  20. package/dist/integrations/langchain.d.cts +231 -0
  21. package/dist/integrations/langchain.d.ts +231 -0
  22. package/dist/integrations/langchain.js +5239 -0
  23. package/dist/integrations/openai.cjs +5367 -0
  24. package/dist/integrations/openai.d.cts +167 -0
  25. package/dist/integrations/openai.d.ts +167 -0
  26. package/dist/integrations/openai.js +5362 -0
  27. package/dist/integrations/semantic.cjs +5314 -0
  28. package/dist/integrations/semantic.d.cts +268 -0
  29. package/dist/integrations/semantic.d.ts +268 -0
  30. package/dist/integrations/semantic.js +5309 -0
  31. package/dist/integrations/vercel-ai.cjs +5282 -0
  32. package/dist/integrations/vercel-ai.d.cts +224 -0
  33. package/dist/integrations/vercel-ai.d.ts +224 -0
  34. package/dist/integrations/vercel-ai.js +5273 -0
  35. package/dist/ml/index.cjs +207 -0
  36. package/dist/ml/index.d.cts +5 -2
  37. package/dist/ml/index.d.ts +5 -2
  38. package/dist/ml/index.js +203 -1
  39. package/dist/ml/transformers.cjs +5237 -0
  40. package/dist/ml/transformers.d.cts +232 -0
  41. package/dist/ml/transformers.d.ts +232 -0
  42. package/dist/ml/transformers.js +5231 -0
  43. package/dist/multimodal/audio.cjs +5269 -0
  44. package/dist/multimodal/audio.d.cts +255 -0
  45. package/dist/multimodal/audio.d.ts +255 -0
  46. package/dist/multimodal/audio.js +5264 -0
  47. package/dist/multimodal/index.cjs +5432 -0
  48. package/dist/multimodal/index.d.cts +4 -0
  49. package/dist/multimodal/index.d.ts +4 -0
  50. package/dist/multimodal/index.js +5422 -0
  51. package/dist/multimodal/ocr.cjs +5193 -0
  52. package/dist/multimodal/ocr.d.cts +157 -0
  53. package/dist/multimodal/ocr.d.ts +157 -0
  54. package/dist/multimodal/ocr.js +5187 -0
  55. package/dist/react.cjs +5133 -0
  56. package/dist/react.d.cts +13 -0
  57. package/dist/react.d.ts +13 -0
  58. package/dist/react.js +5131 -0
  59. package/dist/types-B9c_ik4k.d.cts +88 -0
  60. package/dist/types-B9c_ik4k.d.ts +88 -0
  61. package/dist/types-BuKh9tvV.d.ts +20 -0
  62. package/dist/types-Ct_ueYqw.d.cts +76 -0
  63. package/dist/types-Ct_ueYqw.d.ts +76 -0
  64. package/dist/types-DI8nzwWc.d.cts +20 -0
  65. package/package.json +170 -3
package/dist/index.cjs CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var react = require('react');
4
-
5
3
  // ../../shared/dictionaries/arabic.json
6
4
  var arabic_default = {
7
5
  words: [
@@ -5173,31 +5171,6 @@ async function checkProfanityAsync(text, config) {
5173
5171
  function isWordProfane(word, config) {
5174
5172
  return checkProfanity(word, config).containsProfanity;
5175
5173
  }
5176
- var useProfanityChecker = (config) => {
5177
- const [result, setResult] = react.useState(null);
5178
- const checkText = react.useCallback((text) => {
5179
- const checkResult = checkProfanity(text, config);
5180
- setResult(checkResult);
5181
- return checkResult;
5182
- }, [config]);
5183
- const checkTextAsync = react.useCallback(async (text) => {
5184
- const checkResult = await checkProfanityAsync(text, config);
5185
- setResult(checkResult);
5186
- return checkResult;
5187
- }, [config]);
5188
- const isWordProfaneCallback = react.useCallback((word) => {
5189
- return isWordProfane(word, config);
5190
- }, [config]);
5191
- const reset = react.useCallback(() => setResult(null), []);
5192
- return {
5193
- result,
5194
- checkText,
5195
- checkTextAsync,
5196
- reset,
5197
- isDirty: result?.containsProfanity ?? false,
5198
- isWordProfane: isWordProfaneCallback
5199
- };
5200
- };
5201
5174
 
5202
5175
  exports.Filter = Filter;
5203
5176
  exports.ProfanityFilter = Filter;
@@ -5217,4 +5190,3 @@ exports.normalizeLeetspeak = normalizeLeetspeak;
5217
5190
  exports.normalizeNFKD = normalizeNFKD;
5218
5191
  exports.normalizeUnicode = normalizeUnicode;
5219
5192
  exports.removeZeroWidthCharacters = removeZeroWidthCharacters;
5220
- exports.useProfanityChecker = useProfanityChecker;
package/dist/index.d.cts CHANGED
@@ -1,36 +1,12 @@
1
- import { F as FilterConfig, S as SeverityLevel, C as CheckProfanityResult } from './types-Dj5vaoch.cjs';
2
- export { c as ContextAwareConfig, a as Filter, b as FilteredProfanityResult, H as HybridAnalysisResult, L as Language, e as MLAnalysisResult, f as MLDetectorConfig, M as Match, a as ProfanityFilter, T as ToxicityLabel, d as ToxicityPrediction } from './types-Dj5vaoch.cjs';
3
-
4
- /**
5
- * Configuration options for the profanity checker hook and functions.
6
- * Extends FilterConfig with additional convenience options for V3 features.
7
- */
8
- interface ProfanityCheckerConfig extends Omit<FilterConfig, 'logProfanity'> {
9
- /** Minimum severity level to include in results */
10
- minSeverity?: SeverityLevel;
11
- /** Auto-replace profanity with replaceWith string */
12
- autoReplace?: boolean;
13
- /** Custom callback when profanity is detected */
14
- customActions?: (result: CheckProfanityResult) => void;
15
- }
16
- interface ProfanityCheckResult extends CheckProfanityResult {
17
- filteredWords: string[];
18
- autoReplaced: string;
19
- }
1
+ import { P as ProfanityCheckerConfig, a as ProfanityCheckResult } from './types-DI8nzwWc.cjs';
2
+ export { F as Filter, F as ProfanityFilter } from './Filter-D34Wsmrj.cjs';
3
+ export { C as CheckProfanityResult, b as ContextAwareConfig, F as FilterConfig, a as FilteredProfanityResult, L as Language, M as Match, S as SeverityLevel } from './types-B9c_ik4k.cjs';
4
+ export { H as HybridAnalysisResult, a as MLAnalysisResult, M as MLDetectorConfig, T as ToxicityLabel, b as ToxicityPrediction } from './types-Ct_ueYqw.cjs';
20
5
 
21
6
  declare function checkProfanity(text: string, config?: ProfanityCheckerConfig): ProfanityCheckResult;
22
7
  declare function checkProfanityAsync(text: string, config?: ProfanityCheckerConfig): Promise<ProfanityCheckResult>;
23
8
  declare function isWordProfane(word: string, config?: ProfanityCheckerConfig): boolean;
24
9
 
25
- declare const useProfanityChecker: (config?: ProfanityCheckerConfig) => {
26
- result: CheckProfanityResult;
27
- checkText: (text: string) => ProfanityCheckResult;
28
- checkTextAsync: (text: string) => Promise<ProfanityCheckResult>;
29
- reset: () => void;
30
- isDirty: boolean;
31
- isWordProfane: (word: string) => boolean;
32
- };
33
-
34
10
  /**
35
11
  * @fileoverview Leetspeak detection and normalization utilities.
36
12
  * Converts leetspeak/1337 speak text back to standard characters for profanity detection.
@@ -279,4 +255,4 @@ declare function detectCharacterSets(text: string): {
279
255
  hasMixed: boolean;
280
256
  };
281
257
 
282
- export { CheckProfanityResult, FilterConfig, type LeetspeakLevel, type LeetspeakOptions, type ProfanityCheckResult, type ProfanityCheckerConfig, SeverityLevel, type UnicodeNormalizationOptions, checkProfanity, checkProfanityAsync, collapseRepeatedCharacters, collapseSpacedCharacters, containsLeetspeak, containsUnicodeObfuscation, convertFullWidth, convertHomoglyphs, detectCharacterSets, generateLeetspeakVariants, isWordProfane, normalizeLeetspeak, normalizeNFKD, normalizeUnicode, removeZeroWidthCharacters, useProfanityChecker };
258
+ export { type LeetspeakLevel, type LeetspeakOptions, ProfanityCheckResult, ProfanityCheckerConfig, type UnicodeNormalizationOptions, checkProfanity, checkProfanityAsync, collapseRepeatedCharacters, collapseSpacedCharacters, containsLeetspeak, containsUnicodeObfuscation, convertFullWidth, convertHomoglyphs, detectCharacterSets, generateLeetspeakVariants, isWordProfane, normalizeLeetspeak, normalizeNFKD, normalizeUnicode, removeZeroWidthCharacters };
package/dist/index.d.ts CHANGED
@@ -1,36 +1,12 @@
1
- import { F as FilterConfig, S as SeverityLevel, C as CheckProfanityResult } from './types-Dj5vaoch.js';
2
- export { c as ContextAwareConfig, a as Filter, b as FilteredProfanityResult, H as HybridAnalysisResult, L as Language, e as MLAnalysisResult, f as MLDetectorConfig, M as Match, a as ProfanityFilter, T as ToxicityLabel, d as ToxicityPrediction } from './types-Dj5vaoch.js';
3
-
4
- /**
5
- * Configuration options for the profanity checker hook and functions.
6
- * Extends FilterConfig with additional convenience options for V3 features.
7
- */
8
- interface ProfanityCheckerConfig extends Omit<FilterConfig, 'logProfanity'> {
9
- /** Minimum severity level to include in results */
10
- minSeverity?: SeverityLevel;
11
- /** Auto-replace profanity with replaceWith string */
12
- autoReplace?: boolean;
13
- /** Custom callback when profanity is detected */
14
- customActions?: (result: CheckProfanityResult) => void;
15
- }
16
- interface ProfanityCheckResult extends CheckProfanityResult {
17
- filteredWords: string[];
18
- autoReplaced: string;
19
- }
1
+ import { P as ProfanityCheckerConfig, a as ProfanityCheckResult } from './types-BuKh9tvV.js';
2
+ export { F as Filter, F as ProfanityFilter } from './Filter-BGcyIAvO.js';
3
+ export { C as CheckProfanityResult, b as ContextAwareConfig, F as FilterConfig, a as FilteredProfanityResult, L as Language, M as Match, S as SeverityLevel } from './types-B9c_ik4k.js';
4
+ export { H as HybridAnalysisResult, a as MLAnalysisResult, M as MLDetectorConfig, T as ToxicityLabel, b as ToxicityPrediction } from './types-Ct_ueYqw.js';
20
5
 
21
6
  declare function checkProfanity(text: string, config?: ProfanityCheckerConfig): ProfanityCheckResult;
22
7
  declare function checkProfanityAsync(text: string, config?: ProfanityCheckerConfig): Promise<ProfanityCheckResult>;
23
8
  declare function isWordProfane(word: string, config?: ProfanityCheckerConfig): boolean;
24
9
 
25
- declare const useProfanityChecker: (config?: ProfanityCheckerConfig) => {
26
- result: CheckProfanityResult;
27
- checkText: (text: string) => ProfanityCheckResult;
28
- checkTextAsync: (text: string) => Promise<ProfanityCheckResult>;
29
- reset: () => void;
30
- isDirty: boolean;
31
- isWordProfane: (word: string) => boolean;
32
- };
33
-
34
10
  /**
35
11
  * @fileoverview Leetspeak detection and normalization utilities.
36
12
  * Converts leetspeak/1337 speak text back to standard characters for profanity detection.
@@ -279,4 +255,4 @@ declare function detectCharacterSets(text: string): {
279
255
  hasMixed: boolean;
280
256
  };
281
257
 
282
- export { CheckProfanityResult, FilterConfig, type LeetspeakLevel, type LeetspeakOptions, type ProfanityCheckResult, type ProfanityCheckerConfig, SeverityLevel, type UnicodeNormalizationOptions, checkProfanity, checkProfanityAsync, collapseRepeatedCharacters, collapseSpacedCharacters, containsLeetspeak, containsUnicodeObfuscation, convertFullWidth, convertHomoglyphs, detectCharacterSets, generateLeetspeakVariants, isWordProfane, normalizeLeetspeak, normalizeNFKD, normalizeUnicode, removeZeroWidthCharacters, useProfanityChecker };
258
+ export { type LeetspeakLevel, type LeetspeakOptions, ProfanityCheckResult, ProfanityCheckerConfig, type UnicodeNormalizationOptions, checkProfanity, checkProfanityAsync, collapseRepeatedCharacters, collapseSpacedCharacters, containsLeetspeak, containsUnicodeObfuscation, convertFullWidth, convertHomoglyphs, detectCharacterSets, generateLeetspeakVariants, isWordProfane, normalizeLeetspeak, normalizeNFKD, normalizeUnicode, removeZeroWidthCharacters };
package/dist/index.js CHANGED
@@ -1,5 +1,3 @@
1
- import { useState, useCallback } from 'react';
2
-
3
1
  // ../../shared/dictionaries/arabic.json
4
2
  var arabic_default = {
5
3
  words: [
@@ -5171,30 +5169,5 @@ async function checkProfanityAsync(text, config) {
5171
5169
  function isWordProfane(word, config) {
5172
5170
  return checkProfanity(word, config).containsProfanity;
5173
5171
  }
5174
- var useProfanityChecker = (config) => {
5175
- const [result, setResult] = useState(null);
5176
- const checkText = useCallback((text) => {
5177
- const checkResult = checkProfanity(text, config);
5178
- setResult(checkResult);
5179
- return checkResult;
5180
- }, [config]);
5181
- const checkTextAsync = useCallback(async (text) => {
5182
- const checkResult = await checkProfanityAsync(text, config);
5183
- setResult(checkResult);
5184
- return checkResult;
5185
- }, [config]);
5186
- const isWordProfaneCallback = useCallback((word) => {
5187
- return isWordProfane(word, config);
5188
- }, [config]);
5189
- const reset = useCallback(() => setResult(null), []);
5190
- return {
5191
- result,
5192
- checkText,
5193
- checkTextAsync,
5194
- reset,
5195
- isDirty: result?.containsProfanity ?? false,
5196
- isWordProfane: isWordProfaneCallback
5197
- };
5198
- };
5199
5172
 
5200
- export { Filter, Filter as ProfanityFilter, SeverityLevel, checkProfanity, checkProfanityAsync, collapseRepeatedCharacters, collapseSpacedCharacters, containsLeetspeak, containsUnicodeObfuscation, convertFullWidth, convertHomoglyphs, detectCharacterSets, generateLeetspeakVariants, isWordProfane, normalizeLeetspeak, normalizeNFKD, normalizeUnicode, removeZeroWidthCharacters, useProfanityChecker };
5173
+ export { Filter, Filter as ProfanityFilter, SeverityLevel, checkProfanity, checkProfanityAsync, collapseRepeatedCharacters, collapseSpacedCharacters, containsLeetspeak, containsUnicodeObfuscation, convertFullWidth, convertHomoglyphs, detectCharacterSets, generateLeetspeakVariants, isWordProfane, normalizeLeetspeak, normalizeNFKD, normalizeUnicode, removeZeroWidthCharacters };