UNPKG

kana-romaji

Version:

A simple function to convert Hiragana and Katakana into Romaji representation.

30 lines (29 loc) 950 B
/** * Hiragana is transformed into lower case output. * Katakana is transformed into UPPER case output. * ```js * toRomaji('ローマじ') // === 'RŌMAji'; * ``` * The sequences of same vowels and 'ou' output with prolonged vowel of the first. * The sequence of 'ei' is not represented with long 'e'. * ex) * - 'ちちゅうかい', 'chichūkai' * - 'ふりょう', 'furyō' * - 'しょうがくせい', 'shōgakusei' * * Caveat: The rule to not consider as prolonged vowel sound * when the consecutive vowels are from separate Kanjis is not respected. * * ex) 'きいはんとうのばあい' * - OK: 'kiihantōnobaai' * - Our _wrong_ output: 'kīhantōnobāi' * * 'おかあさん' * - should be and is 'okāsan' * * 'とおり' * - should be and is 'tōri' * @param kana The input with Hiragana/Katakana * @returns Romaji representation of the input */ export declare function toRomaji(kana: string): string;