npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

kana-romaji

v0.1.10

Published

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

Downloads

15

Readme

kana-romaji, kana to alphabet converting library

Hiragana is transformed into lower case output. Katakana is transformed into UPPER case output.

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'

Usage

Typescript or modern es

import { toRomaji } from 'kana-romaji';

if (toRomaji('ローマじ') === 'RŌMAji') {
    // do your work
}

Old common JS

var kanaRomaji = require("kana-romaji")

console.log(kanaRomaji.toRomaji('おばあさん'))

What about wanakana?

WanaKana https://github.com/WaniKani/WanaKana offers various conversions between Kana and Romaji. Their functionality was somewhat limited in terms of rules of Romaji. Sequences of vowels 'おう' in 'こうこうせい' are transformed into 'ou' as in 'koukousei' instead of 'kōkōsei'. Despite all above, I appraise them! Thank you for being the inspiration!

References

University of Tokyo had the following document for recommended Romaji representation.

  • https://park.itc.u-tokyo.ac.jp/eigo/UT-Komaba-Nihongo-no-romaji-hyoki-v1.pdf

I use this!

I'm using this library inside word-decks https://github.com/mtomim/word-decks project, a simple learning-card application.

Updates

  • Correction of issue #1, namely, "てぃ" => "tei" instead of "ti"
  • Use apostrophe (’) instead of hyphen (-) after 'n' and before a vowel (or 'y') when they are not to be pronounced together

ex. ほんや => hon’ya, ほにゃ => honya

  • Prefer using 'n' for ん even before 'p', 'b' or 'm'