romanize-japanese

2.1.0 • Public • Published

romanize-japanese

romanize-japanese is a Node.js ES Module port of hepburn package. It's used to convert Hiragana/Katakana to Roman (or vice versa).

visit the original repository for more information about hepburn.

This module also add a beautify parameter to the fromKana hepburn function :

// classic
hepburn.fromKana('きょう') // outputs "KYOU"
// beautified
hepburn.fromKana('きょう', true) // outputs "kyo u"

installation

yarn add romanize-japanese

Usage

on a webpage

<script type=module>
  import {fromKana} from '/node_modules/romanize-japanese/build/romanize-japanese.mjs'
  console.log(fromKana('みみ', true)) // outputs "mi mi"
</script> 

(note: node_modules needs to be publicly accessible from the client)

in a node es module

import romanize from 'romanize-japanese'
 
console.log(romanize.fromKana('みみ', true)) // outputs "mi mi"

or CommonJS script

console.log(require('romanize-japanese').fromKana('みみ', true))

In command line

$ yarn global add romanize-japanese
$ romanize-japanese みみ
mi mi
$

Known limitations

This module will only convert hiragana/katakana literals to roman but will not convert any Kanji characters.

Build (browser version)

  • clone this repository
  • yarn install to install the default dependencies (in package.json)
    • (but for instance) if you want to build another version of hepburn use yarn add hepburn@<version>
  • then run yarn build
  • now build/romanize-japanese.mjs will contain the hepburn es module for browsers

Readme

Keywords

none

Package Sidebar

Install

npm i romanize-japanese

Weekly Downloads

1

Version

2.1.0

License

Apache-2.0

Unpacked Size

27.9 kB

Total Files

9

Last publish

Collaborators

  • vdegenne