Reference · Radical intersection and display forms
radicalsInKanjifunction
The radicals a character is written with, fewest strokes first.
RADKFILE is stored radical by radical, each with the kanji that hold it, because that is the direction a search runs. A kanji page asks the opposite question, and a membership test per radical answers it, which is nothing next to keeping a second copy of the index the other way round. Simplest parts first, so the list reads the way the character is built up. Code point order breaks a tie, never a locale's collation, so the same character lists its parts in the same order on every machine.
Import it
import { radicalsInKanji } from "@johnmorrisdotca/bushu";
Definition
function radicalsInKanji(radicals: readonly Radical[], kanji: string): Radical[]
Parameters
| Name | Type | Description |
|---|---|---|
radicals | readonly Radical[] | The native radical entries; these inputs are read without mutation. |
kanji | string | The kanji to look up, or the supplied kanji list where the signature requires an array. |
Returns
Radical[]
The radicals a character is written with, fewest strokes first.
Examples
import { RADKFILE } from "@johnmorrisdotca/bushu/radkfile";
import { radicalsInKanji } from "@johnmorrisdotca/bushu";
const radicals = RADKFILE.radicals;
console.log(radicalsInKanji(radicals,"海").map(part=>part.radical));[ '乞', '汁', '毋', '母' ]What it prints (run when this page was built)