Created
September 3, 2019 00:59
-
-
Save nortonwong/6b24886c50a05740b187e74775cdded8 to your computer and use it in GitHub Desktop.
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
((text = '') => { | |
const map = { | |
a: '𝓪', | |
A: '𝓐', | |
}; | |
const shift = (char, shift) => String.fromCodePoint(char.codePointAt(0) + shift); | |
Object.entries(map).forEach(([from, to]) => { | |
for (let i = 0; i < 26; i++) { | |
map[shift(from, i)] = shift(to, i); | |
} | |
}); | |
return text.split('').map(c => map[c] || c).join('') || map; | |
})(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment