Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/d3oxy/censor-badwords
An NPM Package which finds and Censors badwords from the given string.
https://github.com/d3oxy/censor-badwords
Last synced: 5 days ago
JSON representation
An NPM Package which finds and Censors badwords from the given string.
- Host: GitHub
- URL: https://github.com/d3oxy/censor-badwords
- Owner: D3OXY
- Created: 2022-02-04T16:31:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-05T09:50:38.000Z (almost 3 years ago)
- Last Synced: 2024-12-19T19:23:06.101Z (15 days ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![](https://www.psdstamps.com/wp-content/uploads/2019/11/grunge-censored-label-png-768x512.png)
# Finds and Censors badwords from the given string.
### Features- Add/Remove words.
- Set of default words available.
- Get word Cencored output..
- Compatible with NodeJS, Javascript, Typescript, HTML etc....
- Censors words from the string given.
- Full Support and frequent bug fixes.
- Supported Languages (English), More coming soon!## Installation
-------------
`npm install censor-badwords`
-------------# Usage
#### Check if the String has a bad word.
```js
const badwords = require('censor-badwords');let message = 'Hi Leon, how are you?'
let hasBadwords = badwords.hasbadwords(message)
if (hasBadwords) {
console.log('Yes, the message has bad words')
} else {
console.log('No, the message does not have a bad words')
}
```#### Censor bad-words from the message
```js
const badwords = require('censor-badwords');let message = 'hi Leon, Wanna have a drink?' //Suppose "drink" is a bad word.
let censoredMessage = badwords.censorMsg(message)
console.log(censoredMessage) //Output will be "hi Leon, Wanna have a ****?"
```#### Add a bad word
```js
const badwords = require('censor-badwords');badwords.addbadword('leon')
```#### Remove a bad word
```js
const badwords = require('censor-badwords');badwords.removebadword('leon')
```
#### List all bad words in the list
```js
const badwords = require('censor-badwords');let bardwordsList = badwords.getbadwords()
console.log(bardwordsList)
```
#### Remove all bad words from the list
```js
const badwords = require('censor-badwords');badwords.emptybadwords()
```
#### Add default bad words to the list
```js
const badwords = require('censor-badwords');badwords.setdefaultbadwords()
```### **Note**
### Alternatively, you can directly edit the file `bad-words.json` in the root directory of the project.------------------------------
### Usefull Links
`Github`: [Click Here](https://github.com/D3OXY)
`Report Issue`: [Click Here](https://github.com/D3OXY/censor-badwords/issues)