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.cjs.js
CHANGED
|
@@ -2607,42 +2607,57 @@ function getWord(searchedWord, dict, kanjiDic, examples, definitions, noteTypeNa
|
|
|
2607
2607
|
deckPath,
|
|
2608
2608
|
tags: []
|
|
2609
2609
|
};
|
|
2610
|
-
if (dictWord.isCommon === true)
|
|
2611
|
-
|
|
2612
|
-
word.tags.push("word::common");
|
|
2613
|
-
}
|
|
2610
|
+
if (dictWord.isCommon === true) word.common = true;
|
|
2611
|
+
const priorities = /* @__PURE__ */ new Set();
|
|
2614
2612
|
if (dictWord.kanjiForms !== void 0)
|
|
2615
2613
|
word.kanjiForms = dictWord.kanjiForms.map(
|
|
2616
2614
|
(dictKanjiForm) => ({
|
|
2617
2615
|
kanjiForm: dictKanjiForm.form,
|
|
2618
|
-
...dictKanjiForm.notes !== void 0 ? {
|
|
2619
|
-
notes:
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2616
|
+
...dictKanjiForm.notes !== void 0 || dictKanjiForm.commonness !== void 0 ? {
|
|
2617
|
+
notes: [
|
|
2618
|
+
...dictKanjiForm.commonness !== void 0 ? ["Common kanji form"].map((commonKf) => {
|
|
2619
|
+
for (const priority of dictKanjiForm.commonness) {
|
|
2620
|
+
word.tags.push(`word::common::${priority}`);
|
|
2621
|
+
priorities.add(priority);
|
|
2622
|
+
}
|
|
2623
|
+
return commonKf;
|
|
2624
|
+
}) : [],
|
|
2625
|
+
...dictKanjiForm.notes?.map((note) => {
|
|
2626
|
+
const noteAndTag = lookupWordNote(
|
|
2627
|
+
note,
|
|
2628
|
+
[],
|
|
2629
|
+
word.tags
|
|
2630
|
+
);
|
|
2631
|
+
return capitalizeString(noteAndTag.note);
|
|
2632
|
+
}) ?? []
|
|
2633
|
+
]
|
|
2627
2634
|
} : {},
|
|
2628
2635
|
...dictKanjiForm.commonness !== void 0 && dictKanjiForm.commonness.length > 0 ? { common: true } : {}
|
|
2629
2636
|
})
|
|
2630
2637
|
);
|
|
2631
2638
|
word.readings = dictWord.readings.map((dictReading) => ({
|
|
2632
2639
|
reading: dictReading.reading,
|
|
2633
|
-
...dictReading.kanjiFormRestrictions !== void 0 || dictReading.notes !== void 0 ? {
|
|
2640
|
+
...dictReading.kanjiFormRestrictions !== void 0 || dictReading.notes !== void 0 || dictReading.commonness !== void 0 ? {
|
|
2634
2641
|
notes: [
|
|
2642
|
+
...dictReading.notes !== void 0 || dictReading.commonness !== void 0 ? [
|
|
2643
|
+
...dictReading.commonness !== void 0 ? ["Common reading"].map((commonR) => {
|
|
2644
|
+
for (const priority of dictReading.commonness)
|
|
2645
|
+
if (!priorities.has(priority))
|
|
2646
|
+
word.tags.push(`word::common::${priority}`);
|
|
2647
|
+
return commonR;
|
|
2648
|
+
}) : [],
|
|
2649
|
+
...dictReading.notes?.map((note) => {
|
|
2650
|
+
const noteAndTag = lookupWordNote(
|
|
2651
|
+
note,
|
|
2652
|
+
[],
|
|
2653
|
+
word.tags
|
|
2654
|
+
);
|
|
2655
|
+
return capitalizeString(noteAndTag.note);
|
|
2656
|
+
}) ?? []
|
|
2657
|
+
] : [],
|
|
2635
2658
|
...dictReading.kanjiFormRestrictions !== void 0 ? dictReading.kanjiFormRestrictions.map(
|
|
2636
2659
|
(restriction) => `Reading restricted to ${restriction}`
|
|
2637
|
-
) : []
|
|
2638
|
-
...dictReading.notes !== void 0 ? dictReading.notes.map((note) => {
|
|
2639
|
-
const noteAndTag = lookupWordNote(
|
|
2640
|
-
note,
|
|
2641
|
-
[],
|
|
2642
|
-
word.tags
|
|
2643
|
-
);
|
|
2644
|
-
return capitalizeString(noteAndTag.note);
|
|
2645
|
-
}) : []
|
|
2660
|
+
) : []
|
|
2646
2661
|
]
|
|
2647
2662
|
} : {},
|
|
2648
2663
|
...dictReading.commonness !== void 0 && dictReading.commonness.length > 0 ? { common: true } : {}
|
|
@@ -2902,10 +2917,7 @@ function getName(searchedName, dict, kanjiDic, examples, noteTypeName, deckPath)
|
|
|
2902
2917
|
deckPath,
|
|
2903
2918
|
tags: []
|
|
2904
2919
|
};
|
|
2905
|
-
if (dictName.isCommon === true)
|
|
2906
|
-
name.common = true;
|
|
2907
|
-
name.tags.push("name::common");
|
|
2908
|
-
}
|
|
2920
|
+
if (dictName.isCommon === true) name.common = true;
|
|
2909
2921
|
if (dictName.kanjiForms !== void 0)
|
|
2910
2922
|
name.kanjiForms = dictName.kanjiForms.map(
|
|
2911
2923
|
(dictKanjiForm) => ({
|
|
@@ -2915,10 +2927,17 @@ function getName(searchedName, dict, kanjiDic, examples, noteTypeName, deckPath)
|
|
|
2915
2927
|
name.nameReadings = dictName.nameReadings.map(
|
|
2916
2928
|
(dictReading) => ({
|
|
2917
2929
|
reading: dictReading.reading,
|
|
2918
|
-
...dictReading.kanjiFormRestrictions !== void 0 ? {
|
|
2919
|
-
notes:
|
|
2920
|
-
(
|
|
2921
|
-
|
|
2930
|
+
...dictReading.kanjiFormRestrictions !== void 0 || dictReading.commonness !== void 0 ? {
|
|
2931
|
+
notes: [
|
|
2932
|
+
...dictReading.commonness !== void 0 ? ["Common reading"].map((commonR) => {
|
|
2933
|
+
for (const priority of dictReading.commonness)
|
|
2934
|
+
name.tags.push(`name::common::${priority}`);
|
|
2935
|
+
return commonR;
|
|
2936
|
+
}) : [],
|
|
2937
|
+
...dictReading.kanjiFormRestrictions?.map(
|
|
2938
|
+
(restriction) => `Reading restricted to ${restriction}`
|
|
2939
|
+
) ?? []
|
|
2940
|
+
]
|
|
2922
2941
|
} : {},
|
|
2923
2942
|
...dictReading.commonness !== void 0 && dictReading.commonness.length > 0 ? { common: true } : {}
|
|
2924
2943
|
})
|