washyourmouthoutwithsoap
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -14,2 +14,3 @@ const argv = require('yargs').argv; | ||
const LOCALES = ['sq','hy','eu','be','bg','ca','hr','cs','da','nl','en','et','fi','fr','gl','de','el','hi','hu','is','id','it','ja','kn','ko','la','lv','lt','mk','ms','ml','mt','mr','mn','my','fa','pl','pt','ro','ru','gd','sr','sk','sl','es','sv','te','th','tr','uk','uz','vi','cy','zu']; | ||
const BASE_LOCALE = 'en'; | ||
const DELIMITER = ':'; | ||
@@ -33,4 +34,16 @@ const ERROR_CREDENTIALS = 'Invalid credentials'; | ||
// Explicitly set source and destination languages | ||
const options = { | ||
from: BASE_LOCALE, | ||
to: job.locale | ||
}; | ||
// For output in the base locale, do not translate | ||
if (job.locale === BASE_LOCALE) { | ||
db.put(key, job.word.toLowerCase(), callback); | ||
return; | ||
} | ||
// Translate | ||
client.translate(job.word, job.locale, (err, result) => { | ||
client.translate(job.word, options, (err, result) => { | ||
if (err) return callback(err); | ||
@@ -37,0 +50,0 @@ if (typeof result !== 'string') return callback(); |
{ | ||
"name": "washyourmouthoutwithsoap", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A list of bad words in many languages.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -73,1 +73,11 @@ const test = require('tap').test; | ||
}); | ||
test('no false positives for common words', t => { | ||
const upResult = wash.check('en', 'what is up with that?'); | ||
t.type(upResult, 'boolean'); | ||
t.false(upResult); | ||
const commentResult = wash.check('fr', 'comment vas-tu?'); | ||
t.type(commentResult, 'boolean'); | ||
t.false(commentResult); | ||
t.end(); | ||
}); |
Sorry, the diff of this file is too big to display
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
8120
181732