chore: added helper variable

This commit is contained in:
Fahim Faisaal
2022-03-28 21:33:34 +06:00
parent 27ae62e5c9
commit 489544da0a

View File

@@ -11,11 +11,13 @@ const Atbash = (str) => {
}
return str.replace(/[a-z]/gi, (char) => {
const charCode = char.charCodeAt()
if (/[A-Z]/.test(char)) {
return String.fromCharCode(90 + 65 - char.charCodeAt())
return String.fromCharCode(90 + 65 - charCode)
}
return String.fromCharCode(122 + 97 - char.charCodeAt())
return String.fromCharCode(122 + 97 - charCode)
})
}