web-mech / badwords

A javascript filter for badwords
MIT License
623 stars 325 forks source link

Gives TypeError on Russian letters #174

Open SeanLangre opened 1 year ago

SeanLangre commented 1 year ago

Code:

var Filter = require("bad-words"); var badWordFilter = new Filter();

var badwordtest = "мило" var teststring = badWordFilter.clean(badwordtest);

Error: Uncaught TypeError TypeError: Cannot read properties of null (reading '0') at clean (..node_modules\bad-words\lib\badwords.js:58:41)

myfunc commented 6 months ago

Need to modify splitRegex prop. By default /\b/ defined as splitter. To support russian language need to set "/\b/gu". But it still not working with a single world, like "Привет"