1.2.0 • Published 9 years ago
grunt-naughty-words v1.2.0
Adapted from Shutterstocks list of Dirty, Naughty, Obscene, and Otherwise Bad Words.
This library provides a grunt task for creating an array of profane words, and a regex to test against, as well as the capability to compile your own obscene word list.
Installation
npm install grunt-naughty-words ---save-dev
grunt.loadNpmTasks('grunt-naughty-words');Usage
// creating a list using grunt
bad_words: {
options: {
languages: ['en', 'it', 'de'], // english, italian and german
varName: 'profanity',
namespace: 'App'
},
all: {
dest: 'dist/javascript/profanity.js'
}
}In JavaScript land, include dist/javascript/profanity.js, which will expose a regex on the namespaced scope (or globally if namespace not provided):
App.profanityRegex.test(potentiallyProfaneWord);Standalone compilation
You may also build a single one-off file, or one with all languages is provided in the dist directory.
# compile naughty words for English, Italian and German
grunt bad_words:allOutput is found in dist/badwords.js.
Languages
| Name | Code |
|---|---|
| Chinese | zh |
| Czech | cs |
| Danish | da |
| Dutch | nl |
| English | en |
| Esperanto | eo |
| Finnish | fi |
| French | fr |
| German | de |
| Hungarian | hu |
| Italian | it |
| Japanese | ja |
| Klingon | tlh |
| Korean | ko |
| Norwegian | no |
| Persian | fa |
| Polish | pl |
| Portuguese | pt |
| Russian | ru |
| Spanish | es |
| Swedish | sv |
| Thai | th |
| Turkish | tr |
References
Wordlist: © 2012–2015 Shutterstock, Inc.
This work is licensed under a Creative Commons Attribution 4.0 International License.
