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.mjs
CHANGED
|
@@ -1317,33 +1317,27 @@ async function generateFurigana(text, bindedFunction) {
|
|
|
1317
1317
|
}
|
|
1318
1318
|
function getValidForms(readings, kanjiForms, wordIsCommon) {
|
|
1319
1319
|
const kanjiFormRestrictions = /* @__PURE__ */ new Set();
|
|
1320
|
-
const
|
|
1321
|
-
(
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
if (wordIsCommon === void 0 || reading.commonness !== void 0)
|
|
1320
|
+
const existValidReadings = readings.some(
|
|
1321
|
+
(r) => r.commonness !== void 0 || (r.notes === void 0 || !r.notes.some((note) => notSearchedForms.has(note))) && (r.kanjiFormRestrictions !== void 0 || wordIsCommon === void 0)
|
|
1322
|
+
);
|
|
1323
|
+
const validReadings = readings.filter((r) => {
|
|
1324
|
+
if (!existValidReadings || r.commonness !== void 0 || r.notes === void 0 || !r.notes.some((note) => notSearchedForms.has(note))) {
|
|
1325
|
+
if (r.kanjiFormRestrictions !== void 0) {
|
|
1326
|
+
for (const kfr of r.kanjiFormRestrictions)
|
|
1327
|
+
kanjiFormRestrictions.add(kfr);
|
|
1328
|
+
if (r.notes === void 0 || !r.notes.some((note) => notSearchedForms.has(note)))
|
|
1330
1329
|
return true;
|
|
1331
1330
|
}
|
|
1332
|
-
|
|
1331
|
+
if (!existValidReadings || wordIsCommon === void 0 || r.commonness !== void 0)
|
|
1332
|
+
return true;
|
|
1333
1333
|
}
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1334
|
+
return false;
|
|
1335
|
+
});
|
|
1336
|
+
const existValidKanjiForms = kanjiForms?.some(
|
|
1337
|
+
(kf) => kanjiFormRestrictions.has(kf.form) || kf.commonness !== void 0 || (kf.notes === void 0 || !kf.notes.some((note) => notSearchedForms.has(note))) && wordIsCommon === void 0
|
|
1337
1338
|
);
|
|
1338
1339
|
const validKanjiForms = kanjiForms?.filter(
|
|
1339
|
-
(
|
|
1340
|
-
if (index === 0) return true;
|
|
1341
|
-
if (existValidKf === true)
|
|
1342
|
-
return kanjiForm.notes === void 0 || !kanjiForm.notes.some(
|
|
1343
|
-
(note) => notSearchedForms.has(note)
|
|
1344
|
-
) && (wordIsCommon === void 0 || kanjiForm.commonness !== void 0) || kanjiFormRestrictions.has(kanjiForm.form);
|
|
1345
|
-
else return true;
|
|
1346
|
-
}
|
|
1340
|
+
(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
|
|
1347
1341
|
);
|
|
1348
1342
|
return {
|
|
1349
1343
|
readings: validReadings,
|