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 🙏

© 2026 – Pkg Stats / Ryan Hefner

kana-utils

v1.0.1

Published

A lightweight, zero-dependency TypeScript library for Japanese kana conversion and manipulation

Downloads

0

Readme

kana-utils

A lightweight, zero-dependency TypeScript library for Japanese kana conversion and manipulation. Convert between Hiragana, Katakana, and Romaji with full support for dakuten, handakuten, youon, and multiple romanization systems.

Features

  • Conversion: Hiragana ↔ Katakana ↔ Romaji
  • Multiple Romanization Systems: Hepburn, Kunrei-shiki, and Nihon-shiki
  • Complete Kana Support: Dakuten, handakuten, youon, small tsu
  • Half-width Katakana: Automatic conversion to full-width

Installation

npm install kana-utils

Quick Start

import { toKatakana, toHiragana, toRomaji } from 'kana-utils';

// Basic conversions
toKatakana('こんにちは'); // "コンニチハ"
toHiragana('コンニチハ'); // "こんにちは"
toRomaji('こんにちは');   // "konnichiha"

// Mixed text handling
toRomaji('こんにちは世界'); // "konnichiha世界"

// Advanced features
toRomaji('きょうと', { useMacrons: true }); // "kyōto"
toRomaji('しち', { system: 'kunrei' });     // "siti"

API Reference

toKatakana(text: string): string

Converts Hiragana and half-width Katakana to full-width Katakana.

toKatakana('こんにちは');    // "コンニチハ"
toKatakana('コンニチハ');        // "コンニチハ"
toKatakana('がっこう');      // "ガッコウ"
toKatakana('きゃっち');      // "キャッチ"

toHiragana(text: string): string

Converts Katakana and half-width Katakana to Hiragana.

toHiragana('コンニチハ');    // "こんにちは"
toHiragana('コンニチハ');        // "こんにちは"
toHiragana('ガッコウ');      // "がっこう"
toHiragana('キャッチ');      // "きゃっち"

toRomaji(text: string, options?: RomajiOptions): string

Converts Hiragana and Katakana to Romaji.

Options:

  • system: 'hepburn' | 'kunrei' | 'nihon' (default: 'hepburn')
  • useMacrons: boolean - Use ō/ū instead of ou/uu (default: false)
// Basic conversion
toRomaji('こんにちは'); // "konnichiha"

// Different romanization systems
toRomaji('しちふじ', { system: 'hepburn' }); // "shichifuji"
toRomaji('しちふじ', { system: 'kunrei' });  // "sitihuzi"
toRomaji('しちふじ', { system: 'nihon' });   // "sitihuzi"

// Macron support
toRomaji('おおきい', { useMacrons: true }); // "ōkii"
toRomaji('ゆうびん', { useMacrons: true }); // "yūbin"

// Complex examples
toRomaji('きっぷ');     // "kippu"
toRomaji('がっこう');   // "gakkou"
toRomaji('しゃしん');   // "shashin"

Supported Kana Features

Basic Kana

toRomaji('あいうえお'); // "aiueo"
toRomaji('かきくけこ'); // "kakikukeko"

Dakuten (濁音) and Handakuten (半濁音)

toRomaji('がぎぐげご'); // "gagigugego"
toRomaji('ぱぴぷぺぽ'); // "papipupepo"

Youon (拗音) - Small Kana

toRomaji('きゃきゅきょ'); // "kyakyukyo"
toRomaji('しゃしゅしょ'); // "shashusho"
toRomaji('ちゃちゅちょ'); // "chachucho"

Small Tsu (促音) - Double Consonants

toRomaji('かった');   // "katta"
toRomaji('きっぷ');   // "kippu"
toRomaji('ざっし');   // "zasshi"

Long Vowels

toRomaji('おおきい');     // "ookii"
toRomaji('おおきい', { useMacrons: true }); // "ōkii"
toRomaji('コーヒー');     // "koohii"

Romanization Systems

Hepburn (Default)

Most common system, used in passports and road signs.

toRomaji('しちふじ'); // "shichifuji"

Kunrei-shiki (訓令式)

Official system in Japan, used in education.

toRomaji('しちふじ', { system: 'kunrei' }); // "sitihuzi"

Nihon-shiki (日本式)

Older system, similar to Kunrei-shiki.

toRomaji('しちふじ', { system: 'nihon' }); // "sitihuzi"

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.

Development

git clone https://github.com/denver-edwards/kana-utils
cd kana-utils
npm install
npm test

License

AGPL-3.0 License - see LICENSE file for details.

Related Projects