Comparing version 1.0.0 to 1.1.0
@@ -0,1 +1,4 @@ | ||
var soundex = require('soundex'), | ||
soundexSeed = require('./soundex.json'); | ||
var Filter = (function() { | ||
@@ -5,2 +8,5 @@ function Filter(options) { | ||
this.list = Array.prototype.concat.apply( require('./lang.json').words, require('badwords-list').array ); | ||
this.soundex = soundexSeed.words.map(function(word) { | ||
return soundex(word); | ||
}); | ||
this.placeHolder = options.placeHolder || '*'; | ||
@@ -14,3 +20,3 @@ this.regex = options.regex || /[^a-zA-z0-9|\$|\@]|\^/g; | ||
var word = words[j].toLowerCase().replace(this.regex, ''); | ||
if(~this.list.indexOf(word)) { | ||
if(~this.list.indexOf(word) || ~this.soundex.indexOf(soundex(word))) { | ||
return true; | ||
@@ -17,0 +23,0 @@ } |
{ | ||
"name": "bad-words", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "A javascript filter for bad words", | ||
@@ -23,3 +23,4 @@ "main": "./lib/badwords", | ||
"dependencies": { | ||
"badwords-list": "^1.0.0" | ||
"badwords-list": "^1.0.0", | ||
"soundex": "^0.2.1" | ||
}, | ||
@@ -26,0 +27,0 @@ "devDependencies": { |
@@ -1,2 +0,2 @@ | ||
badwords v1.0.0 | ||
bad-words v1.1.0 | ||
======== | ||
@@ -43,6 +43,14 @@ | ||
``` | ||
mocha | ||
npm test | ||
``` | ||
======== | ||
###Release Notes | ||
- v1.1.0 / Mar 17 2015: Added soundex support for comparing words to things not in the list | ||
======== | ||
###License | ||
The MIT License (MIT) | ||
@@ -49,0 +57,0 @@ |
@@ -27,3 +27,8 @@ require('assert'); | ||
}); | ||
it('Should detect words not in the list but are similar using soundex', function() { | ||
assert(filter.isProfane('biotch')); | ||
assert(filter.isProfane('asswhole')); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14226
12
576
78
2
+ Addedsoundex@^0.2.1
+ Addedsoundex@0.2.1(transitive)