henkan 3.0.1 → 3.0.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 +16 -22
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.mjs +16 -22
- package/dist/index.mjs.map +2 -2
- package/dist/types/utils.d.ts.map +1 -1
- package/docs/api/functions/convertJMdict.md +1 -1
- package/docs/api/functions/convertJMnedict.md +1 -1
- package/docs/api/functions/convertJawiktionaryAsync.md +1 -1
- package/docs/api/functions/convertJawiktionarySync.md +1 -1
- package/docs/api/functions/convertKanjiDic.md +1 -1
- package/docs/api/functions/convertKradFile.md +1 -1
- package/docs/api/functions/convertRadkFile.md +1 -1
- package/docs/api/functions/convertTanakaCorpus.md +1 -1
- package/docs/api/functions/convertTanakaCorpusWithFurigana.md +1 -1
- package/docs/api/functions/createEntryMaps.md +1 -1
- package/docs/api/functions/generateAnkiNote.md +1 -1
- package/docs/api/functions/generateAnkiNotesFile.md +1 -1
- package/docs/api/functions/getKanji.md +1 -1
- package/docs/api/functions/getKanjiExtended.md +1 -1
- package/docs/api/functions/getName.md +1 -1
- package/docs/api/functions/getWord.md +1 -1
- package/docs/api/functions/getWordDefinitions.md +1 -1
- package/docs/api/functions/getWordDefinitionsWithFurigana.md +1 -1
- package/package.json +4 -4
- package/src/utils.ts +45 -39
package/dist/index.cjs.js
CHANGED
|
@@ -1383,33 +1383,27 @@ async function generateFurigana(text, bindedFunction) {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
function getValidForms(readings, kanjiForms, wordIsCommon) {
|
|
1385
1385
|
const kanjiFormRestrictions = /* @__PURE__ */ new Set();
|
|
1386
|
-
const
|
|
1387
|
-
(
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
if (wordIsCommon === void 0 || reading.commonness !== void 0)
|
|
1386
|
+
const existValidReadings = readings.some(
|
|
1387
|
+
(r) => r.commonness !== void 0 || (r.notes === void 0 || !r.notes.some((note) => notSearchedForms.has(note))) && (r.kanjiFormRestrictions !== void 0 || wordIsCommon === void 0)
|
|
1388
|
+
);
|
|
1389
|
+
const validReadings = readings.filter((r) => {
|
|
1390
|
+
if (!existValidReadings || r.commonness !== void 0 || r.notes === void 0 || !r.notes.some((note) => notSearchedForms.has(note))) {
|
|
1391
|
+
if (r.kanjiFormRestrictions !== void 0) {
|
|
1392
|
+
for (const kfr of r.kanjiFormRestrictions)
|
|
1393
|
+
kanjiFormRestrictions.add(kfr);
|
|
1394
|
+
if (r.notes === void 0 || !r.notes.some((note) => notSearchedForms.has(note)))
|
|
1396
1395
|
return true;
|
|
1397
1396
|
}
|
|
1398
|
-
|
|
1397
|
+
if (!existValidReadings || wordIsCommon === void 0 || r.commonness !== void 0)
|
|
1398
|
+
return true;
|
|
1399
1399
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1400
|
+
return false;
|
|
1401
|
+
});
|
|
1402
|
+
const existValidKanjiForms = kanjiForms?.some(
|
|
1403
|
+
(kf) => kanjiFormRestrictions.has(kf.form) || kf.commonness !== void 0 || (kf.notes === void 0 || !kf.notes.some((note) => notSearchedForms.has(note))) && wordIsCommon === void 0
|
|
1403
1404
|
);
|
|
1404
1405
|
const validKanjiForms = kanjiForms?.filter(
|
|
1405
|
-
(
|
|
1406
|
-
if (index === 0) return true;
|
|
1407
|
-
if (existValidKf === true)
|
|
1408
|
-
return kanjiForm.notes === void 0 || !kanjiForm.notes.some(
|
|
1409
|
-
(note) => notSearchedForms.has(note)
|
|
1410
|
-
) && (wordIsCommon === void 0 || kanjiForm.commonness !== void 0) || kanjiFormRestrictions.has(kanjiForm.form);
|
|
1411
|
-
else return true;
|
|
1412
|
-
}
|
|
1406
|
+
(kf) => existValidKanjiForms === false || kanjiFormRestrictions.has(kf.form) || kf.commonness !== void 0 || (kf.notes === void 0 || !kf.notes.some((note) => notSearchedForms.has(note))) && wordIsCommon === void 0
|
|
1413
1407
|
);
|
|
1414
1408
|
return {
|
|
1415
1409
|
readings: validReadings,
|