henkan 3.0.2 → 3.0.3
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 +50 -31
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.mjs +50 -31
- package/dist/index.mjs.map +2 -2
- package/dist/types/utils.d.ts.map +1 -1
- package/docs/api/functions/generateAnkiNote.md +1 -1
- package/docs/api/functions/generateAnkiNotesFile.md +1 -1
- package/docs/api/functions/getName.md +1 -1
- package/package.json +1 -1
- package/src/utils.ts +68 -34
package/dist/index.mjs
CHANGED
|
@@ -2541,42 +2541,57 @@ function getWord(searchedWord, dict, kanjiDic, examples, definitions, noteTypeNa
|
|
|
2541
2541
|
deckPath,
|
|
2542
2542
|
tags: []
|
|
2543
2543
|
};
|
|
2544
|
-
if (dictWord.isCommon === true)
|
|
2545
|
-
|
|
2546
|
-
word.tags.push("word::common");
|
|
2547
|
-
}
|
|
2544
|
+
if (dictWord.isCommon === true) word.common = true;
|
|
2545
|
+
const priorities = /* @__PURE__ */ new Set();
|
|
2548
2546
|
if (dictWord.kanjiForms !== void 0)
|
|
2549
2547
|
word.kanjiForms = dictWord.kanjiForms.map(
|
|
2550
2548
|
(dictKanjiForm) => ({
|
|
2551
2549
|
kanjiForm: dictKanjiForm.form,
|
|
2552
|
-
...dictKanjiForm.notes !== void 0 ? {
|
|
2553
|
-
notes:
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2550
|
+
...dictKanjiForm.notes !== void 0 || dictKanjiForm.commonness !== void 0 ? {
|
|
2551
|
+
notes: [
|
|
2552
|
+
...dictKanjiForm.commonness !== void 0 ? ["Common kanji form"].map((commonKf) => {
|
|
2553
|
+
for (const priority of dictKanjiForm.commonness) {
|
|
2554
|
+
word.tags.push(`word::common::${priority}`);
|
|
2555
|
+
priorities.add(priority);
|
|
2556
|
+
}
|
|
2557
|
+
return commonKf;
|
|
2558
|
+
}) : [],
|
|
2559
|
+
...dictKanjiForm.notes?.map((note) => {
|
|
2560
|
+
const noteAndTag = lookupWordNote(
|
|
2561
|
+
note,
|
|
2562
|
+
[],
|
|
2563
|
+
word.tags
|
|
2564
|
+
);
|
|
2565
|
+
return capitalizeString(noteAndTag.note);
|
|
2566
|
+
}) ?? []
|
|
2567
|
+
]
|
|
2561
2568
|
} : {},
|
|
2562
2569
|
...dictKanjiForm.commonness !== void 0 && dictKanjiForm.commonness.length > 0 ? { common: true } : {}
|
|
2563
2570
|
})
|
|
2564
2571
|
);
|
|
2565
2572
|
word.readings = dictWord.readings.map((dictReading) => ({
|
|
2566
2573
|
reading: dictReading.reading,
|
|
2567
|
-
...dictReading.kanjiFormRestrictions !== void 0 || dictReading.notes !== void 0 ? {
|
|
2574
|
+
...dictReading.kanjiFormRestrictions !== void 0 || dictReading.notes !== void 0 || dictReading.commonness !== void 0 ? {
|
|
2568
2575
|
notes: [
|
|
2576
|
+
...dictReading.notes !== void 0 || dictReading.commonness !== void 0 ? [
|
|
2577
|
+
...dictReading.commonness !== void 0 ? ["Common reading"].map((commonR) => {
|
|
2578
|
+
for (const priority of dictReading.commonness)
|
|
2579
|
+
if (!priorities.has(priority))
|
|
2580
|
+
word.tags.push(`word::common::${priority}`);
|
|
2581
|
+
return commonR;
|
|
2582
|
+
}) : [],
|
|
2583
|
+
...dictReading.notes?.map((note) => {
|
|
2584
|
+
const noteAndTag = lookupWordNote(
|
|
2585
|
+
note,
|
|
2586
|
+
[],
|
|
2587
|
+
word.tags
|
|
2588
|
+
);
|
|
2589
|
+
return capitalizeString(noteAndTag.note);
|
|
2590
|
+
}) ?? []
|
|
2591
|
+
] : [],
|
|
2569
2592
|
...dictReading.kanjiFormRestrictions !== void 0 ? dictReading.kanjiFormRestrictions.map(
|
|
2570
2593
|
(restriction) => `Reading restricted to ${restriction}`
|
|
2571
|
-
) : []
|
|
2572
|
-
...dictReading.notes !== void 0 ? dictReading.notes.map((note) => {
|
|
2573
|
-
const noteAndTag = lookupWordNote(
|
|
2574
|
-
note,
|
|
2575
|
-
[],
|
|
2576
|
-
word.tags
|
|
2577
|
-
);
|
|
2578
|
-
return capitalizeString(noteAndTag.note);
|
|
2579
|
-
}) : []
|
|
2594
|
+
) : []
|
|
2580
2595
|
]
|
|
2581
2596
|
} : {},
|
|
2582
2597
|
...dictReading.commonness !== void 0 && dictReading.commonness.length > 0 ? { common: true } : {}
|
|
@@ -2836,10 +2851,7 @@ function getName(searchedName, dict, kanjiDic, examples, noteTypeName, deckPath)
|
|
|
2836
2851
|
deckPath,
|
|
2837
2852
|
tags: []
|
|
2838
2853
|
};
|
|
2839
|
-
if (dictName.isCommon === true)
|
|
2840
|
-
name.common = true;
|
|
2841
|
-
name.tags.push("name::common");
|
|
2842
|
-
}
|
|
2854
|
+
if (dictName.isCommon === true) name.common = true;
|
|
2843
2855
|
if (dictName.kanjiForms !== void 0)
|
|
2844
2856
|
name.kanjiForms = dictName.kanjiForms.map(
|
|
2845
2857
|
(dictKanjiForm) => ({
|
|
@@ -2849,10 +2861,17 @@ function getName(searchedName, dict, kanjiDic, examples, noteTypeName, deckPath)
|
|
|
2849
2861
|
name.nameReadings = dictName.nameReadings.map(
|
|
2850
2862
|
(dictReading) => ({
|
|
2851
2863
|
reading: dictReading.reading,
|
|
2852
|
-
...dictReading.kanjiFormRestrictions !== void 0 ? {
|
|
2853
|
-
notes:
|
|
2854
|
-
(
|
|
2855
|
-
|
|
2864
|
+
...dictReading.kanjiFormRestrictions !== void 0 || dictReading.commonness !== void 0 ? {
|
|
2865
|
+
notes: [
|
|
2866
|
+
...dictReading.commonness !== void 0 ? ["Common reading"].map((commonR) => {
|
|
2867
|
+
for (const priority of dictReading.commonness)
|
|
2868
|
+
name.tags.push(`name::common::${priority}`);
|
|
2869
|
+
return commonR;
|
|
2870
|
+
}) : [],
|
|
2871
|
+
...dictReading.kanjiFormRestrictions?.map(
|
|
2872
|
+
(restriction) => `Reading restricted to ${restriction}`
|
|
2873
|
+
) ?? []
|
|
2874
|
+
]
|
|
2856
2875
|
} : {},
|
|
2857
2876
|
...dictReading.commonness !== void 0 && dictReading.commonness.length > 0 ? { common: true } : {}
|
|
2858
2877
|
})
|