ワナカナ <--> WanaKana <--> わなかな
Javascript utility library for checking and converting between Kanji, Hiragana, Katakana, and Romaji
Demo
Visit the website to see WanaKana in action.
Documentation
Extended API reference
Quick Start
Install
yarn add wanakana
# alternatively: npm install wanakana
Or download the minified bundle for browser use
wanakana.min.js
HTML:
<input type="text" id="wanakana-input" autocapitalize="none" />
<script src="node_modules/wanakana/lib/wanakana.min.js"></script>
<script>
const textInput = document.querySelector('#wanakana-input');
wanakana.bind(textInput);
</script>
JavaScript:
const wanakana = require('wanakana');
import wanakana from 'wanakana';
import { toKana, isRomaji } from 'wanakana';
import isKanji from 'wanakana/isKanji';
{
useObsoleteKana: false,
passRomaji: false,
upcaseKatakana: false,
IMEMode: false,
}
wanakana.bind(domElement [, options]);
wanakana.unbind(domElement);
wanakana.isJapanese('泣き虫。!〜')
wanakana.isKana('あーア')
wanakana.isHiragana('げーむ')
wanakana.isKatakana('ゲーム')
wanakana.isKanji('切腹')
wanakana.isMixed('お腹A')
wanakana.isRomaji('Tōkyō and Ōsaka')
wanakana.toKana('ONAJI buttsuuji')
wanakana.toKana('座禅‘zazen’スタイル')
wanakana.toKana('batsuge-mu')
wanakana.toHiragana('toukyou, オオサカ')
wanakana.toHiragana('only カナ', { passRomaji: true })
wanakana.toHiragana('wi', { useObsoleteKana: true })
wanakana.toKatakana('toukyou, おおさか')
wanakana.toKatakana('only かな', { passRomaji: true })
wanakana.toKatakana('wi', { useObsoleteKana: true })
wanakana.toRomaji('ひらがな カタカナ')
wanakana.toRomaji('ひらがな カタカナ', { upcaseKatakana: true })
wanakana.stripOkurigana('お祝い')
wanakana.stripOkurigana('踏み込む')
wanakana.stripOkurigana('踏み込む', { all: true })
wanakana.tokenize('ふふフフ')
wanakana.tokenize('感じ')
wanakana.tokenize('I said "私は悲しい"')
Contributing
Please see CONTRIBUTING.md
Contributors
Credits
Project sponsored by Tofugu & WaniKani
Ports
The following are ports created by the community: