Created
September 12, 2016 13:54
-
-
Save anonymous/3f2b929b44c47bcd2e78db1e116a3bef to your computer and use it in GitHub Desktop.
minimized rot13 function using arrow function notation and map.
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
rot13 = m => m.split("") | |
.map(b=>{ | |
x = b.charCodeAt(); | |
return x>96 && x<123 ? String.fromCharcode((x-84)%26+97) : x>64 && x<91 ? String.fromCharCode((x-52)%26+65) : b}) | |
.join("") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment