1.3.1 β€’ Published 11 months ago

antibiotic v1.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

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 originalString = '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 toCensorArray = ['https://*', 'censor', 'this']
const replacement = undefined
const strict = true

const censoredText = antibiotic.replace({ originalString, toCensorArray, replacement, strict })
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 originalString = '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 toCensorArray = ['https://*', 'censor', 'this']
const replacement = '*'
const strict = true

const censoredText = antibiotic.replace({ originalString, toCensorArray, replacement, strict })
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 ****

No Strict Censoring

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 replacement = '#'
const strict = false

const censoredText = antibiotic.replace({ originalString, toCensorArray, replacement, strict })
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 t-h.1~$, #### 𝔱π”₯𝔦𝔰, π•₯π•™π•šπ•€ or α΄›ΚœΙͺꜱ.

Partial Matching

Use * at the beginning or end of a word for partial replacement

const originalString = 'Carpet | JavaScript | Wholegrain | Together'
const toCensorArray = ['*pet', 'java*', '*leg*', 'get']
const replacement = '*'
const strict = true

const censoredText = antibiotic.replace({ originalString, toCensorArray, replacement, strict })
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
1.3.1

11 months ago

1.3.0

11 months ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago