Obfuscating text or phrases with random uncommon characters to avoid banning. Everyone is free to speak as long as they do so wisely.
- Node.js 18 or higher
- npm 9 or higher
npm install wisely
import wisely from 'wisely';
const text = 'Palestine will be free! Freedom is the right of ALL nations!';
console.log(wisely({ text }));
// P@l3$t|n3 w!ll 83 fr33! Fr33d0m |$ t#3 r!6#t 0f @LL n4t|0n5!
console.log(wisely({ text, phrases: ['palestine', 'free'] }));
// P4l35t1n3 will be fr33! Freedom is the right of ALL nations!
const customCharSet = {
a: ['@', '4'],
e: ['3'],
i: ['1', '!'],
o: ['0'],
s: ['5', '$'],
t: ['7'],
};
console.log(wisely({ text, charSets: [customCharSet] }));
// P@l3$7!n3 w1ll b3 fr33! Fr33d0m 1$ 7h3 r1gh7 0f 4LL n@710n$!
See
options.charsets
for more details.
Returns a string
with the obsfucated text.
Type: object
- Type:
string
- Required:
true
The text to be obscured.
- Type:
string[]
- Required:
false
The specific phrases to be obscured. If not specified or empty, the entire text will be obscured.
Each phrase must be less than or equal to 30 characters and only contain the following characters:
- Alphabets (
a-z
,A-Z
) - Numbers (
0-9
) - Spaces (
- Hyphens (
-
) - Underscores (
_
) - Apostrophes (
'
) - Forward slashes (
/
)
- Type:
boolean
- Default:
false
Whether to obscure in a case-sensitive manner.
- Type:
(string | object)[]
- Default:
['latin']
The character set that will be used for obfuscation. Put the name of the built-in character sets or a custom character set objects.
The valid custom character set must be an object that contains key-value pairs where:
- The key is the character to be replaced. It must be a single alphabet character (
a-z
,A-Z
). - The value is an array of characters that will be used to replace the key. It must be an array of any single characters other than control characters and private use area block.
See the example below.
const customCharSet = {
a: ['@', '4'],
e: ['3'],
i: ['1', '!'],
o: ['0'],
s: ['5', '$'],
t: ['7'],
};
Returns a boolean
whether the character set is valid.
Type: object
The character set that will be checked.
Returns a merged character set object.
Type: string | object
The character set that will be merged. Put the name of the built-in character sets or a custom character set objects.
Below is the built-in character sets available. See the details of each character set in the charsets directory.
charSet Name |
Block Name | Block Range |
---|---|---|
latin |
Basic Latin | \u0000 - \u007f |
latin-1 |
Latin-1 Supplement | \u0080 - \u00ff |
latin-ext-a |
Latin Extended-A | \u0100 - \u017f |
latin-ext-b |
Latin Extended-B | \u0180 - \u024f |
Give a ⭐️ if this project helped you!
Also please consider supporting this project by becoming a sponsor. Your donation will help us to maintain and develop this project and provide you with better support.