Skip to the content

Jisho辞書

The words of JMdict looked up by reading, written form, English meaning, a kanji in them or romaji, in small pieces fetched as needed, safe by default or unfiltered with every sense's marks, and the school grades, JLPT levels, readings, meanings and look-alike pairs of 2,999 kanji, each table an entry point of its own.

Jisho is the Japanese word 辞書 for a dictionary: this one holds Japanese words and kanji. About the name

Contents

Reference · Look words up by reading, written form, English meaning, kanji or romaji

WordsLoadErrorclass

What a lookup rejects with when a piece of the dictionary cannot be fetched, after one retry: a network that is down, a file the host does not serve, a bundler that left the piece out. It names the piece, so a log says which one, and keeps the reason in cause. Nothing else a lookup does rejects with it: a text with no word is an empty answer, and a lookup before loading is a RangeError.

Import it

import { WordsLoadError } from "@johnmorrisdotca/jisho/words";

Definition

class WordsLoadError
new WordsLoadError(kind: WordsPieceKind, index: number | undefined, of: number | undefined, cause: unknown): WordsLoadError

Parameters

NameTypeDescription
kindWordsPieceKind

Which set of pieces it was.

indexnumber | undefined

The number of the piece in its set, if the set is cut in pieces.

ofnumber | undefined

How many pieces the set has.

causeunknown

What the fetch rejected with.

Members

NameTypeDescription
kindWordsPieceKind

Which set of pieces it was.

indexnumber | undefined

The number of the piece in its set, counting from 0; absent for a table or manifest that is one file.

piecestring

The piece, in words: the readings piece 12 of 294.

namestring
messagestring
stack (optional)string | undefined
cause (optional)unknown

Examples

import { loadWords, WordsLoadError } from "@johnmorrisdotca/jisho/words";

try {
  await loadWords("かみ");
} catch (error) {
  if (error instanceof WordsLoadError) console.log(error.kind, error.index, error.cause);
}

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/jisho 2.11.0.