Reference · Satellites: orbital elements in, positions out
foldKanafunction
Fold text for a Japanese search: width and compatibility forms (NFKC: half-width katakana becomes full-width), hiragana to katakana, and a small kana (ッ, ャ, ァ) to its full-size one. The long-vowel mark ー is left as it is, and so is everything that is not kana
(letter case is the caller's, as it is for any search). Put it on both sides of a comparison: foldKana("はっぶる") === foldKana("ハッブル"), and ハッブル is also ハツブル after it, so a reader who types a small kana as a full-size one still finds it.
Import it
import { foldKana } from "@johnmorrisdotca/chikyu-earth/satellites";
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 folded text.
Examples
import { foldKana } from "@johnmorrisdotca/chikyu-earth/satellites";
console.log(foldKana("はっぶる") === foldKana("ハッブル"));
console.log(foldKana("ほし ー"));true
ホシ ーWhat it prints (run when this page was built)