(str: string)
| 1 | function rot13(str: string): string { |
| 2 | return str.replace(/[a-zA-Z]/g, (char) => { |
| 3 | const code = char.charCodeAt(0); |
| 4 | const base = code >= 97 ? 97 : 65; |
| 5 | return String.fromCharCode(((code - base + 13) % 26) + base); |
| 6 | }); |
| 7 | } |
| 8 | |
| 9 | function rot13Reverse(str: string): string { |
| 10 | return rot13(str); |
no outgoing calls
no test coverage detected