henkan 0.1.2 → 0.1.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.
Files changed (54) hide show
  1. package/dist/index.cjs.js +19 -14
  2. package/dist/index.cjs.js.map +2 -2
  3. package/dist/index.mjs +19 -14
  4. package/dist/index.mjs.map +2 -2
  5. package/dist/types/utils.d.ts.map +1 -1
  6. package/docs/api/functions/capitalizeString.md +1 -1
  7. package/docs/api/functions/convertJMdict.md +1 -1
  8. package/docs/api/functions/convertKanjiDic.md +1 -1
  9. package/docs/api/functions/convertKradFile.md +1 -1
  10. package/docs/api/functions/convertRadkFile.md +1 -1
  11. package/docs/api/functions/convertTanakaCorpus.md +1 -1
  12. package/docs/api/functions/generateAnkiNote.md +1 -1
  13. package/docs/api/functions/generateAnkiNotesFile.md +1 -1
  14. package/docs/api/functions/getKanji.md +1 -1
  15. package/docs/api/functions/getKanjiExtended.md +1 -1
  16. package/docs/api/functions/getWord.md +1 -1
  17. package/docs/api/functions/isStringArray.md +1 -1
  18. package/docs/api/functions/isValidArray.md +1 -1
  19. package/docs/api/functions/isValidArrayWithFirstElement.md +1 -1
  20. package/docs/api/functions/makeSSML.md +1 -1
  21. package/docs/api/functions/shuffleArray.md +1 -1
  22. package/docs/api/functions/synthesizeSpeech.md +1 -1
  23. package/docs/api/interfaces/DictKanji.md +4 -4
  24. package/docs/api/interfaces/DictKanjiForm.md +4 -4
  25. package/docs/api/interfaces/DictKanjiMisc.md +5 -5
  26. package/docs/api/interfaces/DictKanjiReading.md +3 -3
  27. package/docs/api/interfaces/DictKanjiReadingMeaning.md +3 -3
  28. package/docs/api/interfaces/DictKanjiReadingMeaningGroup.md +3 -3
  29. package/docs/api/interfaces/DictKanjiWithRadicals.md +3 -3
  30. package/docs/api/interfaces/DictMeaning.md +11 -11
  31. package/docs/api/interfaces/DictRadical.md +4 -4
  32. package/docs/api/interfaces/DictReading.md +5 -5
  33. package/docs/api/interfaces/DictWord.md +7 -7
  34. package/docs/api/interfaces/ExamplePart.md +7 -7
  35. package/docs/api/interfaces/Grammar.md +15 -15
  36. package/docs/api/interfaces/GrammarMeaning.md +3 -3
  37. package/docs/api/interfaces/Kana.md +11 -11
  38. package/docs/api/interfaces/Kanji.md +21 -21
  39. package/docs/api/interfaces/KanjiComponent.md +3 -3
  40. package/docs/api/interfaces/KanjiForm.md +3 -3
  41. package/docs/api/interfaces/Phrase.md +4 -4
  42. package/docs/api/interfaces/Radical.md +16 -16
  43. package/docs/api/interfaces/Reading.md +4 -4
  44. package/docs/api/interfaces/ResultEntry.md +7 -7
  45. package/docs/api/interfaces/TanakaExample.md +5 -5
  46. package/docs/api/interfaces/Translation.md +3 -3
  47. package/docs/api/interfaces/UsefulRegExps.md +9 -9
  48. package/docs/api/interfaces/Word.md +14 -14
  49. package/docs/api/type-aliases/Dict.md +1 -1
  50. package/docs/api/type-aliases/DictName.md +1 -1
  51. package/docs/api/type-aliases/EntryType.md +1 -1
  52. package/docs/api/type-aliases/JLPT.md +1 -1
  53. package/docs/api/type-aliases/Result.md +1 -1
  54. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -1214,6 +1214,13 @@ function convertJMdict(xmlString, examples) {
1214
1214
  const dict = [];
1215
1215
  import_xml2js.default.parseString(dictParsed, (err, result) => {
1216
1216
  if (err) throw err;
1217
+ let tanakaBaseParts = void 0;
1218
+ if (examples)
1219
+ tanakaBaseParts = new Set(
1220
+ examples.map(
1221
+ (example) => example.parts.map((part) => part.baseForm)
1222
+ ).flat()
1223
+ );
1217
1224
  if (result.JMdict && typeof result.JMdict === "object" && isValidArray(result.JMdict.entry))
1218
1225
  for (const entry of result.JMdict.entry) {
1219
1226
  const entryObj = {
@@ -1309,21 +1316,19 @@ function convertJMdict(xmlString, examples) {
1309
1316
  ) : void 0;
1310
1317
  let kanjiFormExamples = false;
1311
1318
  let readingExamples = false;
1312
- if (kanjiForms2) {
1313
- outer: for (const example of examples)
1314
- for (const part of example.parts)
1315
- if (kanjiForms2.has(part.baseForm)) {
1316
- kanjiFormExamples = true;
1317
- break outer;
1318
- }
1319
+ if (kanjiForms2 && kanjiForms2.size > 0 && tanakaBaseParts) {
1320
+ for (const kf of kanjiForms2)
1321
+ if (tanakaBaseParts.has(kf)) {
1322
+ kanjiFormExamples = true;
1323
+ break;
1324
+ }
1319
1325
  }
1320
- if (!kanjiFormExamples) {
1321
- outer: for (const example of examples)
1322
- for (const part of example.parts)
1323
- if (readings2.has(part.baseForm)) {
1324
- readingExamples = true;
1325
- break outer;
1326
- }
1326
+ if (!kanjiFormExamples && readings2.size > 0 && tanakaBaseParts) {
1327
+ for (const r of readings2)
1328
+ if (tanakaBaseParts.has(r)) {
1329
+ readingExamples = true;
1330
+ break;
1331
+ }
1327
1332
  }
1328
1333
  if (kanjiFormExamples || readingExamples)
1329
1334
  entryObj.hasPhrases = true;