All files visuallyIdenticalString.ts

100% Statements 9/9
100% Branches 2/2
100% Functions 1/1
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 691x 4x                                                                                                             4x 4x 35x   4x       1x 1x 1x    
export function replaceVisuallyIdentical(input: string): string {
    const visuallyIdenticalMap: { [key: string]: string } = {
        'a': '𝗮',
        'b': '𝗯',
        'c': '𝗰',
        'd': '𝗱',
        'e': '𝗲',
        'f': '𝗳',
        'g': '𝗴',
        'h': '𝗵',
        'i': '𝗶',
        'j': '𝗷',
        'k': '𝗸',
        'l': '𝗹',
        'm': '𝗺',
        'n': '𝗻',
        'o': '𝗼',
        'p': '𝗽',
        'q': '𝗾',
        'r': '𝗿',
        's': '𝘀',
        't': '𝘁',
        'u': '𝘂',
        'v': '𝘃',
        'w': '𝘄',
        'x': '𝘅',
        'y': '𝘆',
        'z': '𝘇',
        'A': '𝗔',
        'B': '𝗕',
        'C': '𝗖',
        'D': '𝗗',
        'E': '𝗘',
        'F': '𝗙',
        'G': '𝗚',
        'H': '𝗛',
        'I': '𝗜',
        'J': '𝗝',
        'K': '𝗞',
        'L': '𝗟',
        'M': '𝗠',
        'N': '𝗡',
        'O': '𝗢',
        'P': '𝗣',
        'Q': '𝗤',
        'R': '𝗥',
        'S': '𝗦',
        'T': '𝗧',
        'U': '𝗨',
        'V': '𝗩',
        'W': '𝗪',
        'X': '𝗫',
        'Y': '𝗬',
        'Z': '𝗭'
    };
 
    let output = '';
    for (let char of input) {
        output += visuallyIdenticalMap[char] || char;
    }
    return output;
}
 
// Example usage:
const inputString = 'Hello World';
const visuallyIdenticalString = replaceVisuallyIdentical(inputString);
console.log(visuallyIdenticalString); // Output: '𝗛𝗲𝗹𝗹𝗼 𝗪𝗼𝗿𝗹𝗱'