JSPM

badwords-ts

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q26042F
  • License MIT

badword js alternatives

Package Exports

  • badwords-ts
  • badwords-ts/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (badwords-ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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();