Reference · The functions that read the tables
gradeOffunction
Which grade a kanji is taught in.
Import it
import { gradeOf } from "@johnmorrisdotca/jisho";
Definition
function gradeOf(table: GradeTable, kanji: string): SchoolGrade | null
Parameters
| Name | Type | Description |
|---|---|---|
table | GradeTable |
|
kanji | string | One kanji. |
Returns
SchoolGrade | null
The grade, or null when KANJIDIC2 gives the kanji none (it is outside the jōyō and jinmeiyō kanji), or when the text is not exactly one character: an empty text and a text of two kanji are not any kanji's grade.
Examples
import { gradeOf } from "@johnmorrisdotca/jisho";
import { GRADES } from "@johnmorrisdotca/jisho/grades";
console.log(gradeOf(GRADES, "日"), gradeOf(GRADES, "鬱"), gradeOf(GRADES, "龘")); // 1 8 null1 8 nullWhat it prints (run when this page was built)