Socket
Socket
Sign inDemoInstall

badwords-ts

Package Overview
Dependencies
14
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    badwords-ts

badword js alternatives


Version published
Weekly downloads
0
Maintainers
1
Install size
958 kB
Created
Weekly downloads
 

Readme

Source

Badwords-TS

A badwords-js alternatives

Why use Badwords-TS

Do you ever need to use more filters for different languanges than english? Ever though that some of your languanges is not supported by badwords-js? This package will fix those problems for you. By having a list of bad words in clouds, you can load it on the go. An example of the settings can be found in badwords-ts.settings.json.

How to use?

It use singleton so all the settings for the instance can be use all around the projects. For using the instance, just use the instance property from BadwordFilter class.

import BadwordFilter from 'badwords-ts';

///

// Using the singleton instance
BadwordFilter.instance;

///

API

Removing Badwords

BadwordFilter.instance.clean('just a bad word');

Changing the censors/placeholder

// By default is using asterisk (*)
BadwordFilter.instance.placeHolder = '#'; // It will change censors to # instead of *

Add a New Bad Word

BadwordFilter.instance.addWords('txt', 'asd'); // Will mark 'txt' and 'asd' as a bad word

Exclude a Bad Word

BadwordFilter.instance.removeWords('txt', 'asd'); // Will mark 'txt' and 'asd' as not a bad word

Check a word is a bad word

BadwordFilter.instance.isProfane('bad'); // Will return a boolean

Download word banks from the settings

BadwordFilter.instance.downloadWordBank();

Load word banks from the settings

BadwordFilter.instance.loadWordBank();

Keywords

FAQs

Last updated on 03 Sep 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc