Package Exports
- @princedev/redact
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 (@princedev/redact) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
redact
Censors blacklisted words with built in lists of words that can be used.
Table of Contents
Installation
This library is available through the npm registry.
NPM
$ npm -i @princedev/redactYarn
$ yarn add @princedev/redactImport
Start using it by importing the library first.
CommonJS
const redact = require('@princedev/redact');ES6
import { redact } from '@princedev/redact';Usage
Redact or censor a word from a sentence
import { redact } from '@princedev/redact';
const englishProfanity = ['fuck', 'shit', ...];
redact('Fuck yeah', englishProfanity,);
// output: **** yeah
redact('Fuck yeah', englishProfanity, {
grawlix: '$',
replaceByLength: false,
});
// output: $ yeahCan also be done in this way.
import redact from '@princedev/redact';
const englishProfanity = ['fuck', 'shit', ...];
redact.redact('Fuck yeah', englishProfanity);
// output: **** yeah
redact.redact('Fuck yeah', englishProfanity, {
grawlix: '$',
replaceByLength: false,
});
// output: $ yeahRead the docs for more.
Authors
- Prince Neil Cedrick Castro - Initial work
See also the list of contributors who participated in this project.