Created
October 13, 2020 22:20
-
-
Save iahuang/affbf722907009b77a3ad61777936faf to your computer and use it in GitHub Desktop.
Add random diacritics to strings for the purposes of bypassing chat filters etc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const diacritics = []; | |
for (let row = 0; row < 6; row++) { | |
for (let col of "0123456789ABCDEF") { | |
diacritics.push(eval('"\\u03' + row + col + '"')); | |
} | |
} | |
function randomItem(items) { | |
return items[Math.floor(Math.random() * items.length)]; | |
} | |
function addRandomDiacritics(string) { | |
return Array.from(string) | |
.map((c) => c + randomItem(diacritics)) | |
.join(""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment