Reference · Countries and lookup tools
foldKanafunction
Fold kana for a search: half-width katakana to full width, hiragana to katakana, and a small kana to its full-size
one. The long-vowel mark stays, and so does anything that is not kana, including letter case. fold applies this
and then its own rules, and the name lookups use fold, so a small kana and a full-size one find the same place.
Import it
import { foldKana } from "@johnmorrisdotca/kuni";
Definition
function foldKana(text: string): string
Parameters
| Name | Type | Description |
|---|---|---|
text | string | What was typed, or a name to compare it with. |
Returns
string
The text with its kana folded.
Examples
import { foldKana } from "@johnmorrisdotca/kuni";
console.log(foldKana("とうきょう")); // "トウキヨウ"
console.log(foldKana("はっぶる")); // "ハツブル"
console.log(foldKana("ラー")); // "ラー"トウキヨウ
ハツブル
ラーWhat it prints (run when this page was built)