henkan 2.4.1 → 2.4.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
@@ -2603,8 +2603,10 @@ function getWord(searchedWord, dict, kanjiDic, examples, definitions, noteTypeNa
2603
2603
  const readingMatchingKanjiFormExamples = [];
2604
2604
  const readingExamples = [];
2605
2605
  const readingMatchingKanjiForms = /* @__PURE__ */ new Set();
2606
+ const seenPhrases = /* @__PURE__ */ new Set();
2606
2607
  for (const example of exampleList)
2607
2608
  for (let i = 0; i < example.parts.length; i++) {
2609
+ if (seenPhrases.has(example.phrase)) break;
2608
2610
  const part = example.parts[i];
2609
2611
  const readingAsReadingMatch = part.reading !== void 0 && readings.has(part.reading);
2610
2612
  const readingAsInflectedFormMatch = part.inflectedForm !== void 0 && readings.has(part.inflectedForm);
@@ -2622,11 +2624,13 @@ function getWord(searchedWord, dict, kanjiDic, examples, definitions, noteTypeNa
2622
2624
  partIndex: i,
2623
2625
  form: part.baseForm
2624
2626
  });
2627
+ seenPhrases.add(example.phrase);
2625
2628
  break;
2626
2629
  }
2627
2630
  const readingAsBaseFormMatch = readings.has(part.baseForm);
2628
2631
  if (readingAsBaseFormMatch && kanjiForms === void 0) {
2629
2632
  readingExamples.push({ ex: example, partIndex: i });
2633
+ seenPhrases.add(example.phrase);
2630
2634
  break;
2631
2635
  }
2632
2636
  }
@@ -2637,13 +2641,12 @@ function getWord(searchedWord, dict, kanjiDic, examples, definitions, noteTypeNa
2637
2641
  const includeKanjiFormExamples = word.kanjiForms !== void 0;
2638
2642
  let wordExamples = [
2639
2643
  ...includeKanjiFormExamples ? [...readingMatchingKanjiFormExamples, ...kanjiFormExamples] : readingExamples
2640
- ];
2641
- wordExamples.sort(
2644
+ ].toSorted(
2642
2645
  (a, b) => a.ex.phrase.length - b.ex.phrase.length
2643
2646
  );
2644
2647
  readingMatchingKanjiForms.clear();
2648
+ seenPhrases.clear();
2645
2649
  const glossSpecificExamples = [];
2646
- const seenPhrases = /* @__PURE__ */ new Set();
2647
2650
  for (let i = 0; i < word.translations.length; i++)
2648
2651
  outer: for (const example of wordExamples) {
2649
2652
  if (seenPhrases.has(example.ex.phrase)) continue;