henkan 2.2.2 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +8 -8
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +2 -2
- package/dist/types/utils.d.ts.map +1 -1
- package/docs/api/functions/convertJMdict.md +1 -1
- package/docs/api/functions/convertJawiktionaryAsync.md +1 -1
- package/docs/api/functions/convertJawiktionarySync.md +1 -1
- package/docs/api/functions/convertKanjiDic.md +1 -1
- package/docs/api/functions/convertKradFile.md +1 -1
- package/docs/api/functions/convertRadkFile.md +1 -1
- package/docs/api/functions/convertTanakaCorpus.md +1 -1
- package/docs/api/functions/convertTanakaCorpusWithFurigana.md +1 -1
- package/docs/api/functions/createEntryMaps.md +1 -1
- package/docs/api/functions/generateAnkiNote.md +1 -1
- package/docs/api/functions/generateAnkiNotesFile.md +1 -1
- package/docs/api/functions/getKanji.md +1 -1
- package/docs/api/functions/getKanjiExtended.md +1 -1
- package/docs/api/functions/getWord.md +1 -1
- package/docs/api/functions/getWordDefinitions.md +1 -1
- package/docs/api/functions/getWordDefinitionsWithFurigana.md +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1214,7 +1214,8 @@ function shuffleArray(arr) {
|
|
|
1214
1214
|
function getValidForms(readings, kanjiForms, wordIsCommon) {
|
|
1215
1215
|
const kanjiFormRestrictions = /* @__PURE__ */ new Set();
|
|
1216
1216
|
const validReadings = readings.filter(
|
|
1217
|
-
(reading) => {
|
|
1217
|
+
(reading, index) => {
|
|
1218
|
+
if (index === 0) return true;
|
|
1218
1219
|
if (reading.notes === void 0 || !reading.notes.some((note) => notSearchedForms.has(note))) {
|
|
1219
1220
|
if (reading.kanjiFormRestrictions) {
|
|
1220
1221
|
for (const kfr of reading.kanjiFormRestrictions)
|
|
@@ -1227,10 +1228,11 @@ function getValidForms(readings, kanjiForms, wordIsCommon) {
|
|
|
1227
1228
|
return false;
|
|
1228
1229
|
}
|
|
1229
1230
|
);
|
|
1230
|
-
const existValidKf = kanjiForms ? kanjiForms.some(
|
|
1231
|
-
(kf) => (kf.notes === void 0 || !kf.notes.some((note) => notSearchedForms.has(note))) && (wordIsCommon === void 0 || kf.commonness !== void 0) || kanjiFormRestrictions.has(kf.form)
|
|
1231
|
+
const existValidKf = kanjiForms !== void 0 ? kanjiForms.some(
|
|
1232
|
+
(kf, index) => index !== 0 && ((kf.notes === void 0 || !kf.notes.some((note) => notSearchedForms.has(note))) && (wordIsCommon === void 0 || kf.commonness !== void 0) || kanjiFormRestrictions.has(kf.form))
|
|
1232
1233
|
) : void 0;
|
|
1233
|
-
const validKanjiForms = kanjiForms ? kanjiForms.filter((kanjiForm) => {
|
|
1234
|
+
const validKanjiForms = kanjiForms !== void 0 ? kanjiForms.filter((kanjiForm, index) => {
|
|
1235
|
+
if (index === 0) return true;
|
|
1234
1236
|
if (existValidKf === true)
|
|
1235
1237
|
return (kanjiForm.notes === void 0 || !kanjiForm.notes.some(
|
|
1236
1238
|
(note) => notSearchedForms.has(note)
|
|
@@ -2402,9 +2404,7 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2402
2404
|
}
|
|
2403
2405
|
}
|
|
2404
2406
|
}
|
|
2405
|
-
if (glossSpecificExamples.length
|
|
2406
|
-
wordExamples = glossSpecificExamples;
|
|
2407
|
-
else if (glossSpecificExamples.length > 0) {
|
|
2407
|
+
if (glossSpecificExamples.length > 0) {
|
|
2408
2408
|
const exes = glossSpecificExamples;
|
|
2409
2409
|
if (exes.length < 5) {
|
|
2410
2410
|
wordExamples = wordExamples.filter(
|
|
@@ -2419,7 +2419,7 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2419
2419
|
wordExamples = exes;
|
|
2420
2420
|
}
|
|
2421
2421
|
if (wordExamples.length > 0) {
|
|
2422
|
-
word2.phrases = (
|
|
2422
|
+
word2.phrases = (glossSpecificExamples.length === 0 ? wordExamples.slice(0, 5) : wordExamples).map((ex) => ({
|
|
2423
2423
|
phrase: ex.ex.furigana ?? ex.ex.phrase,
|
|
2424
2424
|
translation: ex.ex.translation,
|
|
2425
2425
|
originalPhrase: ex.ex.phrase,
|