Reputation: 1
So recently i was trying to make a code that can completely remove bad words from console but it replaces with ****. How can i completely remove bad words from list?
const Filter = require("bad-words");
const filter = new Filter();
const words = require("./extra-words.json");
filter.addWords(...words);
console.log(filter.clean("Don't be an ash0le"));
Upvotes: 0
Views: 985
Reputation: 29285
According to the docs, you can set empty string as the place holder and then trim the result.
const Filter = require('bad-words');
const customFilter = new Filter({ placeHolder: ''});
customFilter.clean("Don't be an ash0le").trim(); //Don't be an
Upvotes: 4
Reputation: 52
Check the package documentation: https://www.npmjs.com/package/bad-words#placeholder-overrides Instead of replacing with x, replace with empty string.
Upvotes: 2