All Projects → web-mech → Badwords

web-mech / Badwords

Licence: mit
A javascript filter for badwords

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Badwords

unbound-dns-firewall
DNS-Firewall Python script for UNBOUND
Stars: ✭ 23 (-93.15%)
Mutual labels:  blacklist, filter
Hosts Blocklists
Automatically updated, moderated and optimized lists for blocking ads, trackers, malware and other garbage
Stars: ✭ 1,749 (+420.54%)
Mutual labels:  blacklist, filter
FilterDrawer
Android plug-and-play filter that slides
Stars: ✭ 17 (-94.94%)
Mutual labels:  filter
Gulp Filter
Filter files in a `vinyl` stream
Stars: ✭ 308 (-8.33%)
Mutual labels:  filter
Hypermark
Markdown for Humans.
Stars: ✭ 266 (-20.83%)
Mutual labels:  filter
similar-english-words
Give me a word and I’ll give you an array of words that differ by a single letter.
Stars: ✭ 25 (-92.56%)
Mutual labels:  words
Panflute
An Pythonic alternative to John MacFarlane's pandocfilters, with extra helper functions
Stars: ✭ 286 (-14.88%)
Mutual labels:  filter
filter
⏳ Provide filtering, sanitizing, and conversion of Golang data. 提供对Golang数据的过滤,净化,转换。
Stars: ✭ 53 (-84.23%)
Mutual labels:  filter
Awsweeper
A tool for cleaning your AWS account
Stars: ✭ 331 (-1.49%)
Mutual labels:  filter
Gridjs
Advanced table plugin
Stars: ✭ 3,231 (+861.61%)
Mutual labels:  filter
React Search Input
🔍 Simple react.js component for a search input, providing a filter function.
Stars: ✭ 300 (-10.71%)
Mutual labels:  filter
Graphql To Mongodb
Allows for generic run-time generation of filter types for existing graphql types and parsing client requests to mongodb find queries
Stars: ✭ 261 (-22.32%)
Mutual labels:  filter
go-pluralize
Pluralize and singularize any word (golang adaptation of https://www.npmjs.com/package/pluralize)
Stars: ✭ 60 (-82.14%)
Mutual labels:  words
Sensitive
敏感词查找,验证,过滤和替换 🤓 FindAll, Validate, Filter and Replace words.
Stars: ✭ 292 (-13.1%)
Mutual labels:  filter
hookr
PHP action and filter hook system
Stars: ✭ 39 (-88.39%)
Mutual labels:  filter
Openglcamera2
Android OpenGL Camera 2.0 实现 30 种滤镜和抖音特效
Stars: ✭ 305 (-9.23%)
Mutual labels:  filter
jog
Command line tool to view structured(JSON) log like 'tail -f', with filtering by log level and time range
Stars: ✭ 16 (-95.24%)
Mutual labels:  filter
Jschema
A simple, easy to use data modeling framework for JavaScript
Stars: ✭ 261 (-22.32%)
Mutual labels:  filter
Angular Filter
Bunch of useful filters for AngularJS (with no external dependencies!)
Stars: ✭ 2,962 (+781.55%)
Mutual labels:  filter
Android Ffmpeg Camerarecord
使用JavaCV提供的支持, 使用OpenGL实时处理+显示摄像头采集的图像, 并使用FFMPEG实时录制音视频
Stars: ✭ 334 (-0.6%)
Mutual labels:  filter

bad-words

A javascript filter for badwords

Build Status Commitizen friendly semantic-release

Requirements

As of version 2, requires you either have an environment that understands ES2016 and beyond or a transpiler like Babel.

Installation

npm install bad-words --save

Usage

var Filter = require('bad-words'),
    filter = new Filter();

console.log(filter.clean("Don't be an ash0le")); //Don't be an ******

Placeholder Overrides

var Filter = require('bad-words');
var customFilter = new Filter({ placeHolder: 'x'});

customFilter.clean("Don't be an ash0le"); //Don't be an xxxxxx

Regex Overrides

var filter = new Filter({ regex: /\*|\.|$/gi });

var filter = new Filter({ replaceRegex:  /[A-Za-z0-9가-힣_]/g }); 
//multilingual support for word filtering

Add words to the blacklist

var filter = new Filter(); 

filter.addWords('some', 'bad', 'word');

filter.clean("some bad word!") //**** *** ****!

//or use an array using the spread operator

var newBadWords = ['some', 'bad', 'word'];

filter.addWords(...newBadWords);

filter.clean("some bad word!") //**** *** ****!

//or

var filter = new Filter({ list: ['some', 'bad', 'word'] }); 

filter.clean("some bad word!") //**** *** ****!

Instantiate with an empty list

var filter = new Filter({ emptyList: true }); 
filter.clean('hell this wont clean anything'); //hell this wont clean anything

Remove words from the blacklist

let filter = new Filter(); 

filter.removeWords('hells', 'sadist');

filter.clean("some hells word!"); //some hells word!

//or use an array using the spread operator

let removeWords = ['hells', 'sadist'];

filter.removeWords(...removeWords);

filter.clean("some sadist hells word!"); //some sadist hells word!

API

constructor

Filter constructor.

Parameters

  • options object Filter instance options (optional, default {})
    • options.emptyList boolean Instantiate filter with no blacklist
    • options.list array Instantiate filter with custom list
    • options.placeHolder string Character used to replace profane words.
    • options.regex string Regular expression used to sanitize words before comparing them to blacklist.
    • options.replaceRegex string Regular expression used to replace profane words with placeHolder.

isProfane

Determine if a string contains profane language.

Parameters

  • string string String to evaluate for profanity.

replaceWord

Replace a word with placeHolder characters;

Parameters

  • string string String to replace.

clean

Evaluate a string for profanity and return an edited version.

Parameters

  • string string Sentence to filter.

addWords

Add word(s) to blacklist filter / remove words from whitelist filter

Parameters

  • word ...string Word(s) to add to blacklist

removeWords

Add words to whitelist filter

Parameters

  • word ...string Word(s) to add to whitelist.

Testing

npm test

License

The MIT License (MIT)

Copyright (c) 2013 Michael Price

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].