henkan 1.1.1 → 1.1.2

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 CHANGED
@@ -2175,6 +2175,7 @@ var wordAddNoteArray = (arr, cb) => {
2175
2175
  for (const v of arr) cb(v);
2176
2176
  };
2177
2177
  function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeName, deckPath) {
2178
+ var _a;
2178
2179
  try {
2179
2180
  if (!dictWord && id && dict)
2180
2181
  dictWord = dict.find((entry) => entry.id === id);
@@ -2198,7 +2199,7 @@ function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeNa
2198
2199
  kanjiForm: dictKanjiForm.form,
2199
2200
  ...dictKanjiForm.notes ? {
2200
2201
  notes: dictKanjiForm.notes.map((note) => {
2201
- var _a;
2202
+ var _a2;
2202
2203
  const noteAndTag = lookupWordNote(
2203
2204
  note,
2204
2205
  void 0,
@@ -2206,7 +2207,7 @@ function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeNa
2206
2207
  false,
2207
2208
  note
2208
2209
  );
2209
- return capitalizeString((_a = noteAndTag.note) != null ? _a : note);
2210
+ return capitalizeString((_a2 = noteAndTag.note) != null ? _a2 : note);
2210
2211
  })
2211
2212
  } : {},
2212
2213
  ...dictKanjiForm.commonness && dictKanjiForm.commonness.length > 0 ? { common: true } : {}
@@ -2220,7 +2221,7 @@ function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeNa
2220
2221
  (restriction) => `Reading restricted to ${restriction}`
2221
2222
  ) : [],
2222
2223
  ...dictReading.notes ? dictReading.notes.map((note) => {
2223
- var _a;
2224
+ var _a2;
2224
2225
  const noteAndTag = lookupWordNote(
2225
2226
  note,
2226
2227
  void 0,
@@ -2228,7 +2229,7 @@ function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeNa
2228
2229
  false,
2229
2230
  note
2230
2231
  );
2231
- return capitalizeString((_a = noteAndTag.note) != null ? _a : note);
2232
+ return capitalizeString((_a2 = noteAndTag.note) != null ? _a2 : note);
2232
2233
  }) : []
2233
2234
  ]
2234
2235
  } : {},
@@ -2421,9 +2422,9 @@ function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeNa
2421
2422
  ];
2422
2423
  if (wordExamples.length > 0) {
2423
2424
  word.phrases = (wordExamples.length > 5 ? wordExamples.slice(0, 5) : wordExamples).map((ex) => {
2424
- var _a;
2425
+ var _a2;
2425
2426
  return {
2426
- phrase: (_a = ex.ex.furigana) != null ? _a : ex.ex.phrase,
2427
+ phrase: (_a2 = ex.ex.furigana) != null ? _a2 : ex.ex.phrase,
2427
2428
  translation: ex.ex.translation,
2428
2429
  originalPhrase: ex.ex.phrase,
2429
2430
  ...ex.ex.glossNumber ? { glossNumber: ex.ex.glossNumber } : {}
@@ -2435,10 +2436,10 @@ function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeNa
2435
2436
  }
2436
2437
  }
2437
2438
  if (definitions) {
2438
- const pair = definitions.find(
2439
+ const defs = Array.isArray(definitions) ? (_a = definitions.find(
2439
2440
  (wdp) => wdp.wordID === word.id
2440
- );
2441
- if (pair) word.definitions = pair.definitions;
2441
+ )) == null ? void 0 : _a.definitions : definitions.get(word.id);
2442
+ if (defs) word.definitions = defs;
2442
2443
  }
2443
2444
  return word;
2444
2445
  } else throw new Error(`Word${id ? ` ${id}` : ""} not found`);
@@ -2757,7 +2758,7 @@ function generateAnkiNote(entry) {
2757
2758
  (definitionEntry) => {
2758
2759
  var _a;
2759
2760
  return createEntry(
2760
- `<span class="word word-definition${definitionEntry.mayNotBeAccurate === true ? " mnba" : ""}>"<span class="word word-definition-original">${definitionEntry.definition}</span><span class="word word-definition-furigana">${(_a = definitionEntry.furigana) != null ? _a : definitionEntry.definition}</span></span>`
2761
+ `<span class="word word-definition${definitionEntry.mayNotBeAccurate === true ? " mnba" : ""}"><span class="word word-definition-original">${definitionEntry.definition}</span><span class="word word-definition-furigana">${(_a = definitionEntry.furigana) != null ? _a : definitionEntry.definition}</span></span>`
2761
2762
  );
2762
2763
  }
2763
2764
  ).join("") : '<span class="word word-definition">(no definitions)</span>',