Reference · The functions that read the tables
searchKanjifunction
The kanji that hold a piece of text: the character itself, a reading or a meaning, in English or French, ignoring case.
Import it
import { searchKanji } from "@johnmorrisdotca/jisho";
Definition
function searchKanji(kanji: readonly Kanji[], text: string): Kanji[]
Parameters
| Name | Type | Description |
|---|---|---|
kanji | readonly Kanji[] | The rows, from |
text | string | What was typed; blank text matches nothing. |
Returns
Kanji[]
The rows that match: those that are the word typed first, then those that hold it, the commonest first in each.
Examples
import { readKanji, searchKanji } from "@johnmorrisdotca/jisho";
import { KANJI } from "@johnmorrisdotca/jisho/kanji";
console.log(searchKanji(readKanji(KANJI), "mountain")[0]?.kanji); // 山山What it prints (run when this page was built)