jskana
Japanese kana and romaji conversion.
Installation
npm install jskana --save yarn add jskana
Documentation
Writing system checks
isHiragana(str, include_punctuation)
Returns true if all characters in str is hiragana or whitespace.
If include_punctuation is true, punctuation characters will also be accepted.
isKatakana(str, include_punctuation)
Returns true if all characters in str is katakana or whitespace.
If include_punctuation is true, punctuation characters will also be accepted.
isKanji(str, include_punctuation)
Returns true if all characters in str is kanji or whitespace.
If include_punctuation is true, punctuation characters will also be accepted.
isRomaji(str, include_punctuation)
Returns true if all characters in str is romaji or whitespace.
If include_punctuation is true, punctuation characters will also be accepted.
isPunctuation(str)
Returns true if all characters in str is punctuation or whitespace.
String split
splitKanaString(str)
Splits a hiragana or katakana string into separate characters, grouped with small characters.
Example: 'あっさり' will return ['あっ', 'さ', 'り'].
Kana conversion
hiraganaToKatakana(str)
Return a string based on str where all hiragana characters are replaced with katakana.
katakanaToHiragana(str)
Return a string based on str where all katakana characters are replaced with hiragana.
kanaToRomaji(str)
Returns a string based on str where all hiragana and katakana are replaced with romaji.
romajiToHiragana(str)
Returns a string based on str with all romaji replaced with hiragana.
romajiToKatakana(str)
Returns a string based on str with all romaji replaced with katakana.
Examples
const jskana = ; jskana> true jskana> false jskana> true jskana> false jskana> 'あっ' 'さ' 'り' jskana> '「ウマイ モモ コッチャ コイ。 ニガイ モモ アッチャ イケ。」 ト イッタラ、 ' jskana> 'kochani remonwo iremasu。' jskana> 'こちゃに れもんを いれます'