merge: reduce upper & lower & add export default (#960)

This commit is contained in:
Fahim Faisaal
2022-03-28 15:29:21 +06:00
committed by GitHub
parent 3b9af469f6
commit 27ae62e5c9
4 changed files with 9 additions and 17 deletions

View File

@ -12,13 +12,8 @@ const upper = (str) => {
}
return str.replace(
/[a-z]/g,
(_, indexOfLowerChar) => {
const asciiCode = str.charCodeAt(indexOfLowerChar)
return String.fromCharCode(asciiCode - 32)
}
/[a-z]/g, (char) => String.fromCharCode(char.charCodeAt() - 32)
)
}
export { upper }
export default upper