Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bad-words

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bad-words - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

lib/soundex.json

8

lib/badwords.js

@@ -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 @@ }

5

package.json
{
"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'));
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc