abrupt
Version:
(Random - Strings, Numbers, Booleans, Floats, Objects, Arrays) (Crypto - Base64, AES, RSA, MD5, SHA512, Morse, Rot13)
9 lines (7 loc) • 344 B
JavaScript
let alpha = {}
for (let i = 97; i <= 122; i++) alpha[i-97] = String.fromCharCode(i)
module.exports = (input, amount = 13) => input.split(" ").map(x => x.split("").map(i => {
let l = alpha[((i.toLowerCase().charCodeAt(0)-97)+amount)%26] || i
if (i.toUpperCase() == i) l = l.toUpperCase()
return l
})).map(x => x.join("")).join(" ")