ワナカナ <--> WanaKana <--> わなかな
Javascript utility library for checking and converting between Kanji, Hiragana, Katakana, and Romaji
Demo
Visit the website to see WanaKana in action.
Usage
Browser
Use the minified (UMD) bundle (with legacy browser polyfills)
https://unpkg.com/wanakana
<head>
<meta charset="UTF-8">
<script src="https://unpkg.com/wanakana"></script>
</head>
<body>
<input type="text" id="wanakana-input" />
<script>
var textInput = document.getElementById('wanakana-input');
wanakana.bind(textInput, );
</script>
</body>
Node
Install
npm install wanakana
import wanakana from 'wanakana';
import { toKana, isRomaji } from 'wanakana';
Documentation
Extended API reference
Quick Reference
wanakana.bind(domElement [, options]);
wanakana.unbind(domElement);
wanakana.isJapanese('泣き虫。!〜2¥zenkaku')
wanakana.isKana('あーア')
wanakana.isHiragana('げーむ')
wanakana.isKatakana('ゲーム')
wanakana.isKanji('切腹')
wanakana.isRomaji('Tōkyō and Ōsaka')
wanakana.toKana('ONAJI buttsuuji')
wanakana.toKana('座禅‘zazen’スタイル')
wanakana.toKana('batsuge-mu')
wanakana.toKana('wanikani', { customKanaMapping: { na: 'に', ka: 'bana' }) });
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.toRomaji('つじぎり', { customRomajiMapping: { じ: 'zi', つ: 'tu', り: 'li' }) };
wanakana.stripOkurigana('お祝い')
wanakana.stripOkurigana('踏み込む')
wanakana.stripOkurigana('お腹', { leading: true });
wanakana.stripOkurigana('ふみこむ', { matchKanji: '踏み込む' });
wanakana.stripOkurigana('おみまい', { matchKanji: 'お祝い', leading: true });
wanakana.tokenize('ふふフフ')
wanakana.tokenize('hello 田中さん')
wanakana.tokenize('I said 私はすごく悲しい', { compact: true })
Important
Only the browser build via unpkg or wanakana/umd/*.js
includes full polyfills for older browsers.
Contributing
Please see CONTRIBUTING.md
Contributors
Credits
Project sponsored by Tofugu & WaniKani
Ports
The following are ports created by the community: