Comparing version 1.1.0 to 1.1.1
18
index.js
@@ -20,6 +20,3 @@ /** | ||
var finalString = words | ||
fs.readFile(path.join(__dirname,'swearwords.txt'), 'utf8', (err, data) => { | ||
if (err) throw err | ||
// Trim down file input to remove weird encoding/returns | ||
var lines = data.replace(new RegExp('\r','g'),'').split('\n') | ||
swearList(lines => { | ||
for (var i = 0; i < lines.length; i++) { | ||
@@ -36,7 +33,4 @@ var bw = new RegExp(lines[i], 'gi') | ||
hasSwears: (words, callback) => { | ||
fs.readFile(path.join(__dirname,'swearwords.txt'), 'utf8', (err, data) => { | ||
if (err) throw err | ||
swearList(lines =>{ | ||
var b = false | ||
// Trim down file input to remove weird encoding/returns | ||
var lines = data.replace(new RegExp('\r','g'),'').split('\n') | ||
for (var i = 0; i < lines.length; i++) { | ||
@@ -50,2 +44,10 @@ if(words.indexOf(lines[i]) > -1) { | ||
} | ||
} | ||
var swearList = callback => { | ||
fs.readFile(path.join(__dirname,'swearwords.txt'), 'utf8', (err, data) => { | ||
if (err) throw err | ||
data = data.replace(new RegExp('\r','g'),'').split('\n') | ||
callback(data) | ||
}); | ||
} |
{ | ||
"name": "no-swears", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Filter swearwords out of your strings automagically", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
87
5434