# @lazy-cjk/japanese

> Util collection for Japanese text processing. Hiraganize, Katakanize, and Romanize.

Latest version **2.0.0** (published 2026-11-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @lazy-cjk/japanese
pnpm add @lazy-cjk/japanese
yarn add @lazy-cjk/japanese
bun add @lazy-cjk/japanese
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-11-14 |
| First published | 2020-05-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 160.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | hakatashi |
| Maintainers | bluelovers |
| Keywords | japanese, text, unicode, hiragana, katakana, romaji, romanization, unihan, kanji, hanji, CJK |

## Links

- npm: https://www.npmjs.com/package/@lazy-cjk/japanese
- Repository: https://github.com/bluelovers/ws-regexp
- Homepage: https://github.com/bluelovers/ws-regexp/tree/master/packages/@lazy-cjk/japanese#readme
- Issues: https://github.com/bluelovers/ws-regexp/issues
- npm.io page: https://npm.io/package/@lazy-cjk/japanese

## Dependencies (4)

- [tslib](https://npm.io/package/tslib.md) >=2
- [big.js](https://npm.io/package/big.js.md) ^7.0.1
- [lodash](https://npm.io/package/lodash.md) ^4.18.1
- [ts-type](https://npm.io/package/ts-type.md) ^3.0.19

## Alternatives

- [ext-list](https://npm.io/package/ext-list.md) — 6.3M weekly downloads
- [@lexical/selection](https://npm.io/package/@lexical/selection.md) — 3.8M weekly downloads
- [@lexical/text](https://npm.io/package/@lexical/text.md) — 3.6M weekly downloads
- [@lexical/clipboard](https://npm.io/package/@lexical/clipboard.md) — 3.0M weekly downloads
- [@tiptap/extension-mention](https://npm.io/package/@tiptap/extension-mention.md) — 3.0M weekly downloads

## Recent versions

- 2.0.0 (latest) — 2026-11-14
- 1.2.39 — 2026-09-06
- 1.2.38 — 2026-09-06
- 1.2.37 — 2024-09-03
- 1.2.36 — 2024-08-24
- 1.2.35 — 2024-03-01
- 1.2.34 — 2024-01-29
- 1.2.33 — 2023-02-28
- 1.2.28 — 2022-10-16
- 1.2.27 — 2022-02-04
- 1.2.24 — 2021-11-14
- 1.2.19 — 2021-08-13
- 1.2.18 — 2021-07-09
- 1.2.15 — 2021-06-21
- 1.2.12 — 2021-02-04
- … 8 more at https://npm.io/package/@lazy-cjk/japanese/versions

## README

# japanese.js [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependency Status][gemnasium-image]][gemnasium-url] [![Greenkeeper badge](https://badges.greenkeeper.io/hakatashi/japanese.js.svg)](https://greenkeeper.io/)

> Util collection for Japanese text processing. Hiraganize, Katakanize, and Romanize.


## Install

```sh
$ npm install --save japanese
```

## Usage

```js
var japanese = require('japanese');

japanese.hiraganize('ヱヴァンゲリヲン');
```

For crazy syntax sugar junkies:

```js
var japanese = require('japanese/sugar');

'ヱヴァンゲリヲン'.hiraganize();
```

## Command

Command Line Interface is also available.

```
$ npm install japanese -g
$ japanese

  Util collection for Japanese text processing. Hiraganize, Katakanize, and Romanize.

  Usage:
    japanese <input> [options]

  Options:
    -h, --hiraganize   hiraganize input string
    -k, --katakanize   katakanize input string
    -r, --romanize     romanize input string

  Example
    japanese ヱヴァンゲリヲン --hiraganize
```

## API

### japanese.hiraganize(text)

Convert input katakana into hiragana.

#### Arguments

* `text` The text to hiraganize

#### Example

```js
japanese.hiraganize('ヱヴァンゲリヲン');     // ゑゔぁんげりをん
japanese.hiraganize('チヨコバナヽ');         // ちよこばなゝ
japanese.hiraganize('ヹルタースオリジナル'); // ゑ゙るたーすおりじなる
japanese.hiraganize('板垣死ス𪜈');           // 板垣死すとも
```

### japanese.katakanize(text)

Convert input hiragana into katakana.

#### Arguments

* `text` The text to katakanize

#### Example

```js
japanese.katakanize('抹茶あいす');       // 抹茶アイス
japanese.katakanize('ばゞへらあいす');   // バヾヘラアイス
japanese.katakanize('ゐ゙よろん');         // ヸヨロン
japanese.katakanize('本日ゟかき氷解禁'); // 本日ヨリカキ氷解禁
```

### japanese.romanize(text[, config])

Convert input text into romaji.

**important**: Most definitions of Japanese text romanizations require total recognition of
Japanese text, but [robots cannot actually think or understand](http://www.cleverbot.com/)!
Some conversions are hopelessly poor. For example, ISO 3602 defines that "こうし" which
means "講師" must be romanized as "kôsi", while "こうし" which means "子牛" must be romanized
as "kousi" (because 子牛 is mixed word of 子 and 牛), though these are apparently the same
in Kana-form. While japanese.js is very... very very thoroughly tested, this module (and any
other romanization machines) cannot distinguish between these semantics. So unfortunately,
you cannot use this function for official writing or something. Ugh.

#### Arguments

* `text` The text to romanize
* `config` The configuration object or string used to romanize. Described below.

#### Example

```js
japanese.romanize('れんあいかんじょう');       // ren'aikanjō
japanese.romanize('ツァトゥグァ');             // tsatugwa
japanese.romanize('くうぼをきゅう', 'kunrei'); // kûbookyû
japanese.romanize('でんぢゃらす', 'nihon');    // dendyarasu
japanese.romanize('いいづか とおる', {
	'いい': 'ii',
	'おお': 'oh',
});                                            // iizuka tohru
```

#### Configs

Config is represented as plain object, where object keys stand for a collection of
similar characters, and the value determines how these characters are converted.
So the object is not just the same as a conversion table.

Available parameters are following.

| Key  | Available Values    |
|------|---------------------|
| し   | si, shi             |
| ち   | ti, chi             |
| つ   | tu, tsu             |
| ふ   | hu, fu              |
| じ   | zi, ji              |
| ぢ   | di, zi, ji, dzi, dji|
| づ   | du, zu, dsu, dzu    |
| ああ | aa, ah, â, ā, a     |
| いい | ii, ih, î, ī, i     |
| うう | uu, uh, û, ū, u     |
| ええ | ee, eh, ê, ē, e     |
| おお | oo, oh, ô, ō, o     |
| あー | a-, aa, ah, â, ā, a |
| えい | ei, ee, eh, ê, ē, e |
| おう | ou, oo, oh, ô, ō, o |
| んあ | na, n'a, n-a        |
| んば | nba, mba            |
| っち | tti, tchi, cchi     |
| ゐ   | i, wi               |
| を   | o, wo               |

You can also specify these predefined configs by supplying a string. Default is **wikipedia**.

|      | 'wikipedia' | 'traditional hepburn' | 'modified hepburn' | 'kunrei' | 'nihon' |
|------|-------------|-----------------------|--------------------|----------|---------|
| し   | shi         | shi                   | shi                | si       | si      |
| ち   | chi         | chi                   | chi                | ti       | ti      |
| つ   | tsu         | tsu                   | tsu                | tu       | tu      |
| ふ   | fu          | fu                    | fu                 | hu       | hu      |
| じ   | ji          | ji                    | ji                 | zi       | zi      |
| ぢ   | ji          | ji                    | ji                 | zi       | di      |
| づ   | zu          | zu                    | zu                 | zu       | du      |
| ああ | aa          | aa                    | ā                  | â        | ā       |
| いい | ii          | ii                    | ii                 | î        | ī       |
| うう | ū           | ū                     | ū                  | û        | ū       |
| ええ | ee          | ee                    | ē                  | ê        | ē       |
| おお | ō           | ō                     | ō                  | ô        | ō       |
| あー | ā           | ā                     | ā                  | â        | ā       |
| えい | ei          | ei                    | ei                 | ei       | ei      |
| おう | ō           | ō                     | ō                  | ô        | ō       |
| んあ | n'a         | n-a                   | n'a                | n'a      | n'a     |
| んば | nba         | mba                   | nba                | nba      | nba     |
| っち | tchi        | tchi                  | tchi               | tti      | tti     |
| ゐ   | i           | i                     | i                  | i        | wi      |
| を   | o           | wo                    | o                  | o        | wo      |

And here are short notes about these romanizations.

##### Wikipedia style

Source: http://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style/Japan-related_articles#Romanization

The most modern and widely used form of romanization. Wikipedia uses this guideline to name
their article title and text. This is mixed version of traditional and modified Hepburn
and easily recognizable for everyone.

##### Traditional and Modified Hepburn

Source: http://en.wikipedia.org/wiki/Hepburn_romanization

Actually this is not a specification. Hepburn romanization is very widely known but nobody
other than Hepburn knows the REAL definition of these method.

##### Kunrei-shiki and Nihon-shiki

Source: http://www.iso.org/iso/catalogue_detail.htm?csnumber=9029

Kunrei-shiki is defined as ISO 9029 and Nihon-shiki as ISO 9209 Strict. These romanizations
are today kind of obsolete but still the only standardized romanization in the world.


## Roadmap

* japanese.deromanize()
* japanese.cyrillize()
* japanese.decyrillize()
* japanese.hangulize()
* japanese.dehangulize()
* japanese.arabize()
* japanese.dearabize()
* japanese.gyarumojize()
* japanese.isKatakana()
* japanese.isHiragana()
* japanese.isKanji()
* japanese.isJoyoKanji()
* japanese.isKinsoku() (JIS X 4051 compatibility is preferred)
* CLI
  - `--input <file>` and `--output <file>` option
  - `japanese --hiraganize <string>` to work

...and any proposal or idea for enhancing japanese.js is welcomed! [Tell me](https://github.com/hakatashi/japanese.js/issues), [tell me](https://twitter.com/intent/tweet?text=Hey+@hakatashi+I+have+a+great+idea+for+enhancing+japanese.js.+That+is...), [tell me](mailto:hakatasiloving@gmail.com)!

## License

MIT © [hakatashi](http://hakatashi.com/)


[npm-url]: https://npmjs.org/package/japanese
[npm-image]: https://badge.fury.io/js/japanese.svg
[travis-url]: https://travis-ci.org/hakatashi/japanese.js
[travis-image]: https://travis-ci.org/hakatashi/japanese.js.svg?branch=master
[coveralls-url]: https://coveralls.io/r/hakatashi/japanese.js
[coveralls-image]: https://coveralls.io/repos/hakatashi/japanese.js/badge.svg
[gemnasium-url]: https://gemnasium.com/hakatashi/japanese.js
[gemnasium-image]: https://gemnasium.com/hakatashi/japanese.js.svg

---
_Source: https://npm.io/package/@lazy-cjk/japanese · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
