Skip to content

Instantly share code, notes, and snippets.

@Andrew-Pynch
Created April 20, 2023 13:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Andrew-Pynch/967e9ead951f8fc6489da76ea0e30958 to your computer and use it in GitHub Desktop.
Save Andrew-Pynch/967e9ead951f8fc6489da76ea0e30958 to your computer and use it in GitHub Desktop.
Typescript hiragana to romanji map
const hiraganaToRomajiMap: Map<string, string> = new Map([
['あ', 'a'],
['い', 'i'],
['う', 'u'],
['え', 'e'],
['お', 'o'],
['か', 'ka'],
['き', 'ki'],
['く', 'ku'],
['け', 'ke'],
['こ', 'ko'],
['さ', 'sa'],
['し', 'shi'],
['す', 'su'],
['せ', 'se'],
['そ', 'so'],
['た', 'ta'],
['ち', 'chi'],
['つ', 'tsu'],
['て', 'te'],
['と', 'to'],
['な', 'na'],
['に', 'ni'],
['ぬ', 'nu'],
['ね', 'ne'],
['の', 'no'],
['は', 'ha'],
['ひ', 'hi'],
['ふ', 'fu'],
['へ', 'he'],
['ほ', 'ho'],
['ま', 'ma'],
['み', 'mi'],
['む', 'mu'],
['め', 'me'],
['も', 'mo'],
['や', 'ya'],
['ゆ', 'yu'],
['よ', 'yo'],
['ら', 'ra'],
['り', 'ri'],
['る', 'ru'],
['れ', 're'],
['ろ', 'ro'],
['わ', 'wa'],
['を', 'wo'],
['ん', 'n']
]);
// Usage example:
console.log(hiraganaToRomajiMap.get('あ')); // Output: 'a'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment