Skip to content

Instantly share code, notes, and snippets.

@iahuang
Created October 13, 2020 22:20
Show Gist options
  • Save iahuang/affbf722907009b77a3ad61777936faf to your computer and use it in GitHub Desktop.
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.
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