Reference · Radical intersection and display forms
usableRadicalsfunction
The radicals that can still narrow what is left: every one that appears in at least one of the kanji that match now.
A radical in none of the remaining kanji is a dead end, which a picker dims rather than let you click your way to an empty list. The chosen ones stay in the set: taking one back must always be possible. With nothing chosen, every radical can.
Import it
import { usableRadicals } from "@johnmorrisdotca/bushu";
Definition
function usableRadicals(radicals: readonly Radical[], chosen: readonly string[]): Set<string>
Parameters
| Name | Type | Description |
|---|---|---|
radicals | readonly Radical[] | The native radical entries; these inputs are read without mutation. |
chosen | readonly string[] | Chosen RADKFILE keys, interpreted as an intersection of all chosen parts. |
Returns
Set<string>
The radicals that can still narrow what is left: every one that appears in at least one of the kanji that match now.
Examples
import { RADKFILE } from "@johnmorrisdotca/bushu/radkfile";
import { usableRadicals } from "@johnmorrisdotca/bushu";
const radicals = RADKFILE.radicals;
console.log(usableRadicals(radicals,["汁","田"]).has("汁"));trueWhat it prints (run when this page was built)