Japanese Character Optimizer. [English | ๆฅๆฌ่ช]
This module optimize Japanese characters.
Convert to Katakana from Hiragana mutually, or sort list by natural phonetic order, or convert to halfwidth from fullwidth mutually.
- Convert Hiragana <-> Katakana
- Convert halfwidth <-> fullwidth
- Check Hiragana, Katakana, halfwidth, fullwidth, and so on.
- Sort by natural phonetic order.
- Supported voiced marks, prolonged sound marks, iteration marks.
- Has compatible native string object API.
$ yarn add jaco
$ npm i -g jaco
// Partial functions
import toKatakana from 'jaco/fn/toKatakana';
import toHiragana from 'jaco/fn/toHiragana';
toKatakana('ใใใณใดใฎใขใธใชใฉ'); // => ใใใณใดใใขใธใใ
toHiragana('ใใใณใดใฎใขใธใชใฉ'); // => ใซใปใใใฎใใใชใฉ
// Construct instance
import Jaco from 'jaco';
new Jaco('ใใใณใดใฎใขใธใชใฉ').toKatakana(); // => ใใใณใดใใขใธใใ
Usage: jaco [options] <path or string>
Options:
-V, --version output the version number
-K, --katakanize <path or string> convert to Katakana
-H, --hiraganize <path or string> convert to Hiragana
-h, --help output usage information
Function | Args | Description |
---|---|---|
addSemivoicedMarks |
str | ๅๆฟ็นใ่ฟฝๅ ใใ |
addVoicedMarks |
str | ๆฟ็นใ่ฟฝๅ ใใ |
byteSize |
str | ๆๅญๅใฎใใคใใตใคใบใ่ฟใ |
charAt |
str [, index] | ๆๅญๅใใๆๅฎไฝ็ฝฎใฎๆๅญใ่ฟใ |
charCodeAt |
str [, index] | ๆๅฎไฝ็ฝฎใฎ Unicode ใณใผใใใคใณใใ่ฟใ |
combinateSoundMarks |
str [, convertOnly] | ๆฟ็นใปๅๆฟ็นใจใฒใใใชใปใใใใชใ็ตๅใใใ |
concat |
...str | ๅๅธฐ็ใซๆๅญๅ้ฃ็ตใใใใชใ |
convertIterationMarks |
str | ็นฐใ่ฟใ่จๅทใใใชใซ็ฝฎใๆใใ |
convertProlongedSoundMarks |
str | ้ท้ณ็ฌฆใใใชใซ็ฝฎใๆใใ |
endWith |
str, search [, position] | ๅผๆฐใซๆๅฎใใใๆๅญๅใๆซๅฐพใจๅ่ดใใใ |
has |
str, characters | ่ฉฒๅฝใฎๆๅญใฎใใใใใๅซใใงใใใใฉใใ |
hasSmallLetter |
str | ๅฐๆธใๆๅญใๅซใใใฉใใ |
hasSurrogatePair |
str | ใตใญใฒใผใใใขๆๅญๅใๅซใใงใใใใฉใใ |
hasUnpairedSurrogate |
str | ใใขใซใชใฃใฆใใชใใตใญใฒใผใใณใผใใใคใณใใๅซใใงใใใใฉใใ |
includes |
str, search [, position] | ๆๅฎใใใๆๅญๅใๆๅใซ็พใใใคใณใใใฏในใ่ฟใ |
indexOf |
str, search [, fromIndex] | ๆๅฎใใใๆๅญๅใๆๅใซ็พใใใคใณใใใฏในใ่ฟใ |
is |
str, target | ๅฎๅ จใใใ |
isEmpty |
str | ๆๅญใ็ฉบใใฉใใ |
isNumeric |
str [, negative [, floatingPoint]] | ๆฐๅญใ ใใงๆงๆใใใฆใใใใฉใใ |
isOnly |
str, characters | ่ฉฒๅฝใฎๆๅญใ ใใงๆงๆใใใฆใใใใฉใใ |
isOnlyHiragana |
str | ใฒใใใชใ ใใงๆงๆใใใฆใใใใฉใใ |
isOnlyKatakana |
str | ใซใฟใซใใ ใใงๆงๆใใใฆใใใใฉใใ |
lastIndexOf |
str, search [, fromIndex] | ๆๅฎใใใๆๅญๅใๆๅพใซ็พใใใคใณใใใฏในใ่ฟใ |
matches |
str, regexp | ๆญฃ่ฆ่กจ็พใซๅฏพใใๆๅญๅใฎใใใใณใฐใฎ้ใซใใใฎใใใ็ตๆใ็ด็ฒใช้ ๅใงๅพใ |
naturalKanaOrder |
a, b | ้ ๅใฎไบๅ้ณ้ ใฝใผใใใใใใใฎใฝใผใ้ขๆฐ |
naturalKanaSort |
array | ้ ๅใฎไบๅ้ณ้ ใฝใผใใใใ |
padEnd |
str, targetLength [, padString] | ๆ็ต็ใชๆๅญๅใๆๅฎใใใ้ทใใซๅฐ้ใใใใใซๆๅญๅใงๅปถ้ทใใ |
padStart |
str, targetLength [, padString] | ๆ็ต็ใชๆๅญๅใๆๅฎใใใ้ทใใซๅฐ้ใใใใใซๆๅญๅใๅ ้ ญใซ่ฟฝๅ ใใ |
remove |
str, pattern | ๆๅญๅใๅใ้คใ |
removeUnpairedSurrogate |
str | ใใขใซใชใฃใฆใใชใใตใญใฒใผใใณใผใใใคใณใใฎๅ้ค |
removeVoicedMarks |
str [, ignoreSingleMark] | ๆฟ็นใปๅๆฟ็นใๅใ้คใ |
repeat |
str, times | ๆๅญๅใ็นฐใ่ฟใ |
replace |
str, pattern, replacement | ๆๅญๅใใใฟใผใณใง็ฝฎๆใใ |
replaceFromMap |
str, convMap | ใญใผใใใฟใผใณใปๅคใ็ฝฎๆๆๅญๅใฎใใใทใฅใใใใซใใฃใฆ็ฝฎๆใใ |
search |
str, pattern | ๆญฃ่ฆ่กจ็พใซใใใใใใคใณใใใฏในใ่ฟใ |
slice |
str, start [, end] | ๆๅญไฝ็ฝฎใซใใๆฝๅบ |
split |
str, separator | ๆๅญๅใฎ้ ๅใซๅๅฒใใ |
startsWith |
str, search [, position] | ๅผๆฐใซๆๅฎใใใๆๅญๅใๅ ้ ญใจๅ่ดใใใ |
substr |
str, start [, length] | ๆๅฎใใไฝ็ฝฎใใๆๅฎใใๆฐใ ใๆๅญๅใๆฝๅบ |
substring |
str, indexA, indexB | ๆๅฎใใไฝ็ฝฎใฎ้ใฎๆๅญๅใๆฝๅบ |
test |
str, pattern | ใใฟใผใณใจใใใใใใใฉใใ |
toBasicLetter |
str | ๅฐๆธใๆๅญใๅบๅบๆๅญใซๅคๆใใ |
toHiragana |
str [, isCombinate] | ใฒใใใชใซๅคๆใใ |
toKatakana |
str [, toWide] | ใซใฟใซใใซๅคๆใใ |
toNarrow |
str [, convertJapaneseChars] | ๅ่งใซๅคๆ |
toNarrowAlphanumeric |
str | ่ฑๆฐๅญใๅ่งใซๅคๆ |
toNarrowJapanese |
str | ใซใฟใซใใจๆฅๆฌ่ชใงไฝฟใใใ่จๅทใๅ่งใซๅคๆ |
toNarrowKatakana |
str [, fromHiragana] | ๅ่งใซใฟใซใใซๅคๆใใ |
toNarrowSign |
str | ่จๅทใๅ่งใซๅคๆ |
toNarrowSymbolForJapanese |
str | ๆฅๆฌ่ชใงไฝฟใใใ่จๅทใๅ่งใซๅคๆ |
toNumeric |
str [, negative [, floatingPoint]] | ๆฐๅญใซๅคๆใใ |
toPhoeticKana |
str | ใใฟใฎๆๅญใซๅคๆใใ |
toWide |
str | ๅ จ่งใซๅคๆ |
toWideAlphanumeric |
str | ่ฑๆฐๅญใๅ จ่งใซๅคๆ |
toWideJapanese |
str | ใซใฟใซใใจๆฅๆฌ่ชใงไฝฟใใใ่จๅทใๅ จ่งใซๅคๆ |
toWideKatakana |
str | ๅ จ่งใซใฟใซใใซๅคๆใใ |
toWideSign |
str | ่จๅทใๅ จ่งใซๅคๆ |
toWideSymbolForJapanese |
str | ๆฅๆฌ่ชใงไฝฟใใใ่จๅทใๅ จ่งใซๅคๆ |