You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

199 rivejä
2.4 KiB

  1. let blacklist = [
  2. 'anal',
  3. 'anilingus',
  4. 'anus',
  5. 'areola',
  6. 'b1tch',
  7. 'ballsack',
  8. 'bitch',
  9. 'blowjob',
  10. 'boner',
  11. 'boob',
  12. 'breast',
  13. 'bukkake',
  14. 'cameltoe',
  15. 'carpetmuncher',
  16. 'chinc',
  17. 'chink',
  18. 'chode',
  19. 'clit',
  20. 'cock',
  21. 'coital',
  22. 'coon',
  23. 'cum',
  24. 'cunilingus',
  25. 'cunnilingus',
  26. 'cunt',
  27. 'dick',
  28. 'dike',
  29. 'dildo',
  30. 'dong',
  31. 'douche',
  32. 'dumbass',
  33. 'dyke',
  34. 'ejaculate',
  35. 'erection',
  36. 'fack',
  37. 'fag',
  38. 'felch',
  39. 'fellate',
  40. 'fellatio',
  41. 'feltch',
  42. 'foreskin',
  43. 'fuck',
  44. 'fuk',
  45. 'gay',
  46. 'goatse',
  47. 'godamn',
  48. 'goddammit',
  49. 'goddamn',
  50. 'goldenshower',
  51. 'handjob',
  52. 'hardon',
  53. 'hitler',
  54. 'homo',
  55. 'horny',
  56. 'jerkoff',
  57. 'jism',
  58. 'jiz',
  59. 'kkk',
  60. 'labia',
  61. 'lesbo',
  62. 'lezbo',
  63. 'masterbat',
  64. 'masturbat',
  65. 'menstruat',
  66. 'muff',
  67. 'nazi',
  68. 'negro',
  69. 'nigga',
  70. 'niger',
  71. 'nigger',
  72. 'nipple',
  73. 'nympho',
  74. 'oral',
  75. 'orgasm',
  76. 'orgies',
  77. 'orgy',
  78. 'pantie',
  79. 'panty',
  80. 'pedo',
  81. 'penetrat',
  82. 'penial',
  83. 'penile',
  84. 'penis',
  85. 'phalli',
  86. 'phuck',
  87. 'piss',
  88. 'pms',
  89. 'poon',
  90. 'porn',
  91. 'prostitut',
  92. 'pube',
  93. 'pubic',
  94. 'pubis',
  95. 'puss',
  96. 'pussies',
  97. 'pussy',
  98. 'puto',
  99. 'queaf',
  100. 'queef',
  101. 'queer',
  102. 'rape',
  103. 'rapist',
  104. 'rectal',
  105. 'rectum',
  106. 'rectus',
  107. 'reich',
  108. 'rimjob',
  109. 'schlong',
  110. 'scrote',
  111. 'scrotum',
  112. 'semen',
  113. 'sex',
  114. 'shit',
  115. 'skank',
  116. 'slut',
  117. 'sodomize',
  118. 'sperm',
  119. 'spunk',
  120. 'stfu',
  121. 'tampon',
  122. 'tard',
  123. 'testes',
  124. 'testicle',
  125. 'testis',
  126. 'tits',
  127. 'tramp',
  128. 'transsex',
  129. 'turd',
  130. 'twat',
  131. 'undies',
  132. 'urinal',
  133. 'urine',
  134. 'uterus',
  135. 'vag',
  136. 'vagina',
  137. 'viagra',
  138. 'virgin',
  139. 'vulva',
  140. 'wang',
  141. 'wank',
  142. 'weiner',
  143. 'wetback',
  144. 'whoralicious',
  145. 'whore',
  146. 'whoring',
  147. 'wigger',
  148. 'gaes',
  149. 'gaez'
  150. ];
  151. module.exports = {
  152. tree: {},
  153. init: function () {
  154. blacklist.forEach(c => {
  155. this.buildPath(c);
  156. });
  157. },
  158. buildPath: function (chain, node) {
  159. node = node || this.tree;
  160. const letter = chain[0];
  161. if (!node[letter])
  162. node[letter] = {};
  163. if (chain.length > 1)
  164. this.buildPath(chain.substr(1), node[letter]);
  165. },
  166. isClean: function (text, finalLevel) {
  167. text = text
  168. .toLowerCase()
  169. .split(' ')
  170. .join('');
  171. const tree = this.tree;
  172. let tLen = text.length;
  173. for (let i = 0; i < tLen; i++) {
  174. let node = tree;
  175. for (let j = i; j < tLen; j++) {
  176. node = node[text[j]];
  177. if (!node)
  178. break;
  179. else if (Object.keys(node).length === 0)
  180. return false;
  181. }
  182. }
  183. if (!finalLevel)
  184. return this.isClean(text.replace(/[^\w\s]|(.)(?=\1)/gi, ''), true);
  185. return true;
  186. }
  187. };