Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Utility library for checking and converting between Kanji, Hiragana, Katakana, and Romaji
Visit the website to see WanaKana in action.
yarn add wanakana
# alternatively: npm install wanakana
<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); // uses IMEMode toKana() as default
</script>
/* UMD/CommonJS */
const wanakana = require('wanakana');
/* ES modules */
import wanakana from 'wanakana';
// with destructuring
import { toKana, isRomaji } from 'wanakana';
// or directly reference single methods for smaller builds:
import isKanji from 'wanakana/isKanji';
/*** DEFAULT OPTIONS ***/
{
// Use obsolete kana characters, such as ゐ and ゑ.
useObsoleteKana: false,
// Pass through romaji when using toKatakana() or toHiragana()
passRomaji: false,
// Convert katakana to uppercase when using toRomaji()
upcaseKatakana: false,
// Convert characters from a text input while being typed.
IMEMode: false, // alternatives are: true, 'toHiragana', or 'toKatakana'
}
/*** DOM HELPERS ***/
// Automatically converts text using an eventListener on input
// bind() uses option: { IMEMode: true } with `toKana()` by default
// Alternatives are: 'toHiragana' or 'toKatakana' to enforce kana type
wanakana.bind(domElement [, options]);
// Removes event listener
wanakana.unbind(domElement);
/*** TEXT CHECKING UTILITIES ***/
wanakana.isJapanese('泣き虫。!〜2¥')
// => true
wanakana.isKana('あーア')
// => true
wanakana.isHiragana('げーむ')
// => true
wanakana.isKatakana('ゲーム')
// => true
wanakana.isKanji('切腹')
// => true
wanakana.isMixed('お腹A')
// => true
wanakana.isRomaji('Tōkyō and Ōsaka')
// => true
/*
* toKana notes:
* Lowercase -> Hiragana.
* Uppercase -> Katakana.
* Non-romaji and _English_ punctuation is passed through: 123 @#$%
* Limited Japanese equivalent punctuation is converted:
* !?.:/,~-‘’“”[](){}
* !?。:・、〜ー「」『』[](){}
*/
wanakana.toKana('ONAJI buttsuuji')
// => 'オナジ ぶっつうじ'
wanakana.toKana('座禅‘zazen’スタイル')
// => '座禅「ざぜん」スタイル'
wanakana.toKana('batsuge-mu')
// => 'ばつげーむ'
wanakana.toHiragana('toukyou, オオサカ')
// => 'とうきょう、 おおさか'
wanakana.toHiragana('only カナ', { passRomaji: true })
// => 'only かな'
wanakana.toHiragana('wi', { useObsoleteKana: true })
// => 'ゐ'
wanakana.toKatakana('toukyou, おおさか')
// => 'トウキョウ、 オオサカ'
wanakana.toKatakana('only かな', { passRomaji: true })
// => 'only カナ'
wanakana.toKatakana('wi', { useObsoleteKana: true })
// => 'ヰ'
wanakana.toRomaji('ひらがな カタカナ')
// => 'hiragana katakana'
wanakana.toRomaji('ひらがな カタカナ', { upcaseKatakana: true })
// => 'hiragana KATAKANA'
/*** EXTRA UTILITIES ***/
wanakana.stripOkurigana('お祝い')
// => 'お祝'
wanakana.stripOkurigana('踏み込む')
// => '踏み込'
wanakana.stripOkurigana('踏み込む', { all: true })
// => '踏込'
wanakana.tokenize('ふふフフ')
// => ['ふふ', 'フフ']
wanakana.tokenize('感じ')
// => ['感', 'じ']
wanakana.tokenize('I said "私は悲しい"')
// => ['I said "','私', 'は', '悲', 'しい', '"']
Please see CONTRIBUTING.md
Project sponsored by Tofugu & WaniKani
The following are ports created by the community:
[2.3.1] - 2017-10-17
FAQs
Utility library for converting between Kanji, Hiragana, Katakana, and Romaji
The npm package wanakana receives a total of 14,922 weekly downloads. As such, wanakana popularity was classified as popular.
We found that wanakana demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.