Comparing version 1.0.4 to 1.0.5
@@ -21,3 +21,3 @@ 'use strict'; | ||
this.modes = new Map([// Can check modes available, enabled | ||
['choice', { 'enabled': 0, data: [] }], ['funny', { 'enabled': 0, data: ['bunnies', 'butterfly', 'kitten', 'love', 'gingerly', 'flowers', 'puppy', 'joyful', 'rainbows', 'unicorn'] }], ['grawlix', { 'enabled': 0 }], ['asterisks-obscure', { 'enabled': 0 }], ['asterisks-full', { 'enabled': 0 }], ['grawlix', { 'enabled': 0 }], ['spaces', { 'enabled': 0 }], ['black', { 'enabled': 0 }], ['hide', { 'enabled': 0 }], ['bleep', { 'enabled': 0 }]]); | ||
['asterisks-obscure', { 'enabled': 1 }], ['asterisks-full', { 'enabled': 0 }], ['choice', { 'enabled': 0, data: [] }], ['funny', { 'enabled': 0, data: ['bunnies', 'butterfly', 'kitten', 'love', 'gingerly', 'flowers', 'puppy', 'joyful', 'rainbows', 'unicorn'] }], ['grawlix', { 'enabled': 0 }], ['grawlix', { 'enabled': 0 }], ['spaces', { 'enabled': 0 }], ['black', { 'enabled': 0 }], ['hide', { 'enabled': 0 }], ['bleep', { 'enabled': 0 }]]); | ||
@@ -271,85 +271,85 @@ this.wholeWord = 0; | ||
//Search each word | ||
var toReturn = strings.map(function (string) { | ||
var modeElected = modesEnabled[randomRange(0, modesEnabled.length)] || 'spaces'; | ||
var processed = strings.map(function (string) { | ||
return modesEnabled.map(function (mode) { | ||
var toProcess = string; | ||
//localesAllWords, modeElected, string | ||
localesAllWords.forEach(function (word) { | ||
if (string.indexOf(word) !== -1) { | ||
(function () { | ||
var wordLength = word.length; | ||
var replaceStr = function () { | ||
switch (modeElected) { | ||
case 'choice': | ||
{ | ||
var list = _this5.modes.get('choice').data; | ||
return list[randomRange(0, list.length)] || ''; | ||
} | ||
case 'funny': | ||
{ | ||
var _list = _this5.modes.get('funny').data; | ||
return _list[randomRange(0, _list.length)] || ''; | ||
} | ||
case 'spaces': | ||
{ | ||
return ' '.repeat(wordLength); | ||
} | ||
case 'black': | ||
{ | ||
return '■'.repeat(wordLength); | ||
} | ||
case 'asterisks-full': | ||
{ | ||
return '*'.repeat(wordLength); | ||
} | ||
case 'asterisks-obscure': | ||
{ | ||
return word[0] + '*'.repeat(wordLength - 2) + word[word.length - 1]; | ||
} | ||
case 'bleep': | ||
{ | ||
return 'BLEEP'; | ||
} | ||
case 'grawlix': | ||
{ | ||
var _ret2 = function () { | ||
var grawlixChars = ['!', '@', '#', '$', '%', '&', '*']; | ||
return { | ||
v: word.split('').map(function (char) { | ||
return grawlixChars[randomRange(0, grawlixChars.length)]; | ||
}).join('') | ||
}; | ||
}(); | ||
localesAllWords.forEach(function (word) { | ||
if (toProcess.indexOf(word) !== -1) { | ||
(function () { | ||
var wordLength = word.length; | ||
var replaceStr = function () { | ||
switch (mode) { | ||
case 'choice': | ||
{ | ||
var list = _this5.modes.get('choice').data; | ||
return list[randomRange(0, list.length)] || ''; | ||
} | ||
case 'funny': | ||
{ | ||
var _list = _this5.modes.get('funny').data; | ||
return _list[randomRange(0, _list.length)] || ''; | ||
} | ||
case 'spaces': | ||
{ | ||
return ' '.repeat(wordLength); | ||
} | ||
case 'black': | ||
{ | ||
return '■'.repeat(wordLength); | ||
} | ||
case 'asterisks-full': | ||
{ | ||
return '*'.repeat(wordLength); | ||
} | ||
case 'asterisks-obscure': | ||
{ | ||
return word[0] + '*'.repeat(wordLength - 2) + word[word.length - 1]; | ||
} | ||
case 'bleep': | ||
{ | ||
return 'BLEEP'; | ||
} | ||
case 'grawlix': | ||
{ | ||
var _ret2 = function () { | ||
var grawlixChars = ['!', '@', '#', '$', '%', '&', '*']; | ||
return { | ||
v: word.split('').map(function (char) { | ||
return grawlixChars[randomRange(0, grawlixChars.length)]; | ||
}).join('') | ||
}; | ||
}(); | ||
if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === "object") return _ret2.v; | ||
} | ||
case 'hide': | ||
{ | ||
return ''; | ||
} | ||
//asterisks-obscure | ||
default: | ||
{ | ||
return word[0] + '*'.repeat(wordLength - 2) + word[word.length - 1]; | ||
} | ||
} | ||
}(); | ||
if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === "object") return _ret2.v; | ||
} | ||
case 'hide': | ||
{ | ||
return ''; | ||
} | ||
//asterisks-obscure | ||
default: | ||
{ | ||
return word[0] + '*'.repeat(wordLength - 2) + word[word.length - 1]; | ||
} | ||
} | ||
}(); | ||
string = function () { | ||
var reqexp = new RegExp(word, 'gi'); | ||
if (_this5.wholeWord) { | ||
reqexp = new RegExp('\\b' + word + '\\b', 'gi'); | ||
} | ||
toProcess = function () { | ||
var reqexp = new RegExp(word, 'gi'); | ||
if (_this5.wholeWord) { | ||
reqexp = new RegExp('\\b' + word + '\\b', 'gi'); | ||
} | ||
return string.replace(reqexp, replaceStr); | ||
}(); | ||
})(); | ||
} | ||
return toProcess.replace(reqexp, replaceStr); | ||
}(); | ||
})(); | ||
} | ||
}); | ||
return toProcess; | ||
}); | ||
return string; | ||
}); | ||
var whatIsReturn = whatIs(toReturn); | ||
return whatIsReturn == 'Array' && toReturn.length == 1 ? toReturn[0] : toReturn; | ||
var whatIsReturn = whatIs(processed); | ||
return whatIsReturn == 'Array' && processed.length == 1 ? processed[0] : processed; | ||
} | ||
@@ -356,0 +356,0 @@ }]); |
{ | ||
"name": "profam", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Profanity and Spam Tool, supporting multiple languages and modes.", | ||
@@ -24,2 +24,3 @@ "keywords": [ | ||
"build": "babel source --out-file distribution/profam.js", | ||
"buildw" : "babel -w source --out-file distribution/profam.js", | ||
"prepublish": "npm run build" | ||
@@ -26,0 +27,0 @@ }, |
@@ -60,6 +60,6 @@ # Profam | ||
| profanity.setLocalesDir(\<string\>) | String | Replaces [locale] with the language you want to download. Ex: example.com/locales/[locale].js | null | | ||
| profanity.setLocales(\<string/array\>) | <ol><li>Locale(s)</li></ol> | Add the languages you wonna look for bad-words | | | ||
| profanity.setLocales(\<string/array\>, \<true/false\>, \<true/false\> | <ol><li>Locales(s)</li><li>is custom</li><li>keep existing</li></ol> | Add the languages you wonna look for bad-words | <ol><li>Empty</li><li>false</li><li>false</li></ol> | | ||
| profanity.addWords(\<string\>, \<array\>) | <ol><li>Locale</li></ol><ol><li>Words</li></ol> | Add new words in selected locale. | | | ||
| profanity.removeWords(\<string\>, \<array\>) | <ol><li>Locale</li></ol><ol><li>Words</li></ol> | Remove words from locale. | | | ||
| profanity.setModes(\<string/array\>, \<true/false\>, \<true/false\> | <ol><li>Mode(s)</li><li>is custom</li><li>keep existing</li></ol> | Set Modes | <ol><li>asterisks-obscure</li><li>false</li><li>false</li></ol> | | ||
| profanity.setModes(\<string/array\>) | <ol><li>Mode(s)</li></ol> | Set Modes | asterisks-obscure | | ||
| profanity.getLocales() | | Get Locales | | | ||
@@ -66,0 +66,0 @@ | profanity.getLocalesEnabled() | | Get Locales Enabled | | |
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
81302
60
522