New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@2toad/profanity

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@2toad/profanity

A JavaScript profanity filter

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5K
decreased by-76.87%
Maintainers
1
Weekly downloads
 
Created
Source

Profanity

GitHub version Downloads Build Status

A JavaScript profanity filter

Getting Started

Install package

npm i @2toad/profanity

Usage

import { profanity } from '@2toad/profanity';

profanity.exists('I like big butts and I cannot lie');
// true

profanity.exists('I like big buttocks and I cannot lie');
// false

profanity.censor('I like big butts (and ar5e) and I cannot lie');
// I like big @#$%&! (and @#$%&!) and I cannot lie

Options

There are several configurable options you can set when you create an instance of the Profanity class:

import { Profanity, ProfanityOptions } from '@2toad/profanity';

const options = new ProfanityOptions();
options.wholeWord = false;
options.grawlix = '*****';

const profanity = new Profanity(options);

wholeWord

By default this is set to true, so profanity only matches on whole words:

profanity.exists('Two profane words joined: buttsAr5e');
// false

Setting this to false, results in:

profanity.exists('Two profane words joined: buttsAr5e');
// true

grawlix

By default this is set to @#$%&!:

profanity.censor('I like big butts and I cannot lie');
// I like big @#$%&! and I cannot lie

Setting this to ****, results in:

profanity.censor('I like big butts and I cannot lie');
// I like big **** and I cannot lie

Customize the word list

Remove words:

profanity.removeWords(['butt', 'ar5e']);

Add words:

profanity.addWords(['aardvark', 'zebra']);

Keywords

FAQs

Package last updated on 13 Oct 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc