Getting started
Getting started
Install the package, look a word up, read a grade and a level, and look a kanji up.
Install
npm install @johnmorrisdotca/jishoRead a list
Each table is an entry point of its own, so an import loads only that table.
import {gradeOf,kanjiOfLevel} from "@johnmorrisdotca/jisho";
import {GRADES} from "@johnmorrisdotca/jisho/grades";
import {JLPT} from "@johnmorrisdotca/jisho/jlpt";
console.log(gradeOf(GRADES,"語"));
console.log(kanjiOfLevel(JLPT,"N5").length);2
79Look a kanji up
readKanji turns the stored table into plain rows. Build a Map once and keep it, if a page looks up more than a few.
import {readKanji} from "@johnmorrisdotca/jisho";
import {KANJI} from "@johnmorrisdotca/jisho/kanji";
const byKanji=new Map(readKanji(KANJI).map((one)=>[one.kanji,one]));
console.log(byKanji.get("山")?.meanings);[ 'mountain' ]Look a word up
Words are fetched in small pieces, only the ones a lookup needs, so loadWords waits and wordsOf does not.
import {loadWords,wordsOf} from "@johnmorrisdotca/jisho/words";
const words=await loadWords("かみ");
console.log(wordsOf(words,"かみ")[0]?.meaning);paperWhat to read next
Look words up says how to look a word up by its reading or its written form, how to choose safe or unfiltered words and pass your own lists, and how to keep the dictionary out of a server's bundle. The words can also be found by their English meaning, by a kanji in them and in romaji; how common a word is, looking up a conjugated word, reading a text and odd input and pieces that will not load have a guide each. Find kanji has the recipes, how the look-alike pairs are measured says what a score means, and where the data comes from says what you must credit.