japanese-easy
is a utility package designed to make it easier to work with Japanese Kana and Kanji data. This package provides functions for fetching Kanji and Kana information, converting Kanji to Kana, retrieving Kanji lists, and accessing Hiragana and Katakana charts.
- Lookup Kanji data, including meanings, readings, and more.
- Lookup Kana (Hiragana/Katakana) details.
- Convert Kanji to Kana for better understanding of pronunciation.
- Retrieve a list of Kanji based on grades or other filters.
- Access complete Hiragana and Katakana charts.
- Lookup specific words and their meanings.
- Lookup random words or words by JLPT level.
- Retrieve all available words, optionally filtered by level.
Install the package via npm:
npm install japanese-easy
Here are examples of how to use the japanese-easy
package:
import * as japanese_easy from 'japanese-easy';
japanese_easy.lookupKanji('猫').then(data => {
console.log("Result from lookupKanji:", data);
});
japanese_easy.lookupKana('あ').then(data => {
console.log("Result from lookupKana:", data);
});
japanese_easy.convertKanjiToKana('猫').then(data => {
console.log("Result from convertKanjiToKana:", data);
});
japanese_easy.lookupKanjiList('grade-1').then(data => {
console.log("Result from lookupKanjiList:", data);
});
japanese_easy.getHiraganaChart().then(data => {
console.log("Result from getHiraganaChart:", data);
});
japanese_easy.getKatakanaChart().then(data => {
console.log("Result from getKatakanaChart:", data);
});
japanese_easy.lookupWord('夜更かし').then(data => {
console.log("Result from lookupWord:", data);
});
japanese_easy.lookupWordsByLevel(3).then(data => {
console.log("Result from lookupWordsByLevel (N3):", data);
});
japanese_easy.lookupRandomWord().then(data => {
console.log("Result from lookupRandomWord:", data);
});
japanese_easy.lookupRandomWord(1).then(data => {
console.log("Result from lookupRandomWord (N1):", data);
});
japanese_easy.lookupAllWords().then(data => {
console.log("Result from lookupAllWords:", data);
});
japanese_easy.lookupAllWords(3).then(data => {
console.log("Result from lookupAllWords (N3):", data);
});
Fetches detailed information about a given Kanji.
- Parameter:
kanji
- The Kanji character to lookup. - Returns: A Promise resolving to Kanji data.
Fetches information about a given Kana (Hiragana or Katakana).
- Parameter:
kana
- The Kana character to lookup. - Returns: A Promise resolving to Kana data.
Converts a string of Kanji into Kana for better pronunciation.
- Parameter:
text
- A string containing Kanji. - Returns: A Promise resolving to the Kana equivalent.
Fetches a list of Kanji based on a specified filter (e.g., grade level).
The lookupKanjiList
function supports the following categories as parameters:
-
joyo
orjouyou
: List of Jōyō Kanji. -
jinmeiyo
orjinmeiyou
: List of Jinmeiyō Kanji. -
heisig
: List of Kanji with a Heisig keyword. -
kyouiku
orkyouiku
: List of all Kyōiku Kanji. -
grade-1
: List of Grade 1 Kyōiku Kanji. -
grade-2
: List of Grade 2 Kyōiku Kanji. -
grade-3
: List of Grade 3 Kyōiku Kanji. -
grade-4
: List of Grade 4 Kyōiku Kanji. -
grade-5
: List of Grade 5 Kyōiku Kanji. -
grade-6
: List of Grade 6 Kyōiku Kanji. -
grade-8
: List of Jōyō Kanji excluding Kyōiku Kanji. -
all
: List of all 13,000+ available Kanji. -
Parameter:
filter
- A string filter such as "grade-1". -
Returns: A Promise resolving to an array of Kanji.
Fetches detailed information about a specific word.
- Parameter:
word
- The word to lookup. - Returns: A Promise resolving to word data.
Fetches words by their JLPT level.
- Parameter:
level
- The JLPT level (e.g., 1, 2, 3, 4, 5). - Returns: A Promise resolving to an array of words.
Fetches a random word, optionally filtered by JLPT level.
- Parameter:
level
- The JLPT level (optional). - Returns: A Promise resolving to a random word.
Fetches all available words, optionally filtered by JLPT level.
- Parameter:
level
- The JLPT level (optional). - Returns: A Promise resolving to an array of words.
Fetches the complete Hiragana chart.
- Returns: A Promise resolving to a Hiragana chart object.
Fetches the complete Katakana chart.
- Returns: A Promise resolving to a Katakana chart object.
To run tests for the package, use:
npm run test
This will execute the tests/core.js
file.
For more information, visit the Japanese Easy website.
Contributions are welcome! If you have suggestions or find bugs, feel free to open an issue or submit a pull request on GitHub.
If you encounter any problems, please report them at the issues page.
This project is licensed under the MIT License. See the LICENSE file for details.
Developed by Kurizu.
- GitHub: @crizmo