1.1.0 • Published 7 years ago

keyword-checkor v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

keyword-checkor

check if a string has senstive words

var KeyWordCheckor = require('keyword-checkor');
var checkor = new KeyWordCheckor(['蛤蟆', '长城']);
checkor.addWord('老习');

var keys = checkor.hasWord("蛤蟆去了西安");
console.log(keys);
//[ '蛤蟆' ]

var key1 = checkor.hasWord("蛤蟆去了长城");
console.log(key1);
//[ '蛤蟆', '长城' ]

var s = checkor.replace("蛤蟆去了长城");
console.log(s);
//**去了**


checkor.removeWord("蛤蟆");
var s1 = checkor.replace("蛤蟆去了长城");
console.log(s1);
//蛤蟆去了**

PS: part of code copy from text-censor

License

MIT