Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Utility library for checking and converting between Kanji, Hiragana, Katakana, and Romaji
Visit the website to see WanaKana in action.
<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, /* options */); // uses IMEMode with toKana() as default
// to remove event listeners: wanakana.unbind(textInput);
</script>
</body>
npm install wanakana
import wanakana from 'wanakana';
// or
import { toKana, isRomaji } from 'wanakana';
/*** 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'
// Choose toRomaji() romanization map
romanization: 'hepburn' // (currently only hepburn)
// custom map will be merged with default conversion
customKanaMapping: {}
// toKana('wanikani', { customKanaMapping: { na: 'に', ka: 'bana' }) });
// => 'わにbanaに'
customRomajiMapping: {}
// toRomaji('つじぎり', { customRomajiMapping: { じ: 'zi', つ: 'tu', り: 'li' }) };
// => 'tuzigili'
}
/*** TEXT CHECKING UTILITIES ***/
wanakana.isJapanese('泣き虫。!〜2¥zenkaku')
// => true
wanakana.isKana('あーア')
// => true
wanakana.isHiragana('げーむ')
// => true
wanakana.isKatakana('ゲーム')
// => true
wanakana.isKanji('切腹')
// => 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 "','私', 'は', '悲', 'しい', '"']
Only the browser build via unpkg or wanakana/umd/*.js
include polyfills for older browsers.
Please see CONTRIBUTING.md
Project sponsored by Tofugu & WaniKani
The following are ports created by the community:
FAQs
Utility library for converting between Kanji, Hiragana, Katakana, and Romaji
The npm package wanakana receives a total of 7,262 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.