1.2.0 β’ Published 7 months ago
antibiotic v1.2.0
About Antibiotic π
The right medication to care your sentences from unwanted words by censoring or cleaning them. Strong against common bypass methods like using different fonts or symbols between words. 0 dependencies!
Installation
npm i antibiotic
Replace
const { Antibiotic } = require('antibiotic')
const antibiotic = new Antibiotic();
const string = 'Here is a sentence that tries to share a fishy link https://example.com/login, but dont worry it will get censored even when you try to bypass it like t-h.1.$, thhhhiiiisss, π±π₯π¦π°, π₯πππ€ or α΄ΚΙͺκ±.'
const array = ['https://*', 'censor', 'this']
const censoredText = antibiotic.replace(string, array)
console.log(censoredText)
// > Here is a sentence that tries to share a fishy link #@****@##@*#*#***##@*@# but dont worry it will get ***@@#ed even when you try to bypass it like @#*@ #@@# *@@* or #@**
Custom Replacement Symbol
const replacement = '*'
const censoredText = antibiotic.replace(string, array, replacement)
console.log(censoredText)
// > Here is a sentence that tries to share a fishy link *********************** but dont worry it will get ******ed even when you try to bypass it like **** **** **** or ****
Partial Matching
Use * at the beginning or end of a word for partial replacement
const string = 'Carpet | JavaScript | Wholegrain | Together'
const array = ['*pet', 'java*', '*leg*', 'get']
const replacement = '*'
const censoredText = antibiotic.replace(string, array, replacement)
console.log(censoredText)
// > ****** ********** ********** to***her
Convert
const { Antibiotic } = require('antibiotic')
const antibiotic = new Antibiotic();
const string = 'α»αΆΗαΆαΉΖΓ βπ©π’ππ« πΎπΉ π₯πππ€ ππ
΄ππ'
const cleanedText = antibiotic.convert(string)
console.log(censoredText)
// > ExAmPlE Clean up this text