update tag
This commit is contained in:
1 parent
16d1307744
commit
292beabffe
3 files changed
+20
-4
No files matched your search
@@ -26,6 +26,8 @@ async function makeWaniKaniKanjiLevels(
|
|||||||
for (const k of wkKanji) {
|
for (const k of wkKanji) {
|
||||||
const { level, characters } = k.data;
|
const { level, characters } = k.data;
|
||||||
const label = WaniKani.getLevelLabel(level);
|
const label = WaniKani.getLevelLabel(level);
|
||||||
|
if (!label) throw new Error(`Invalid level: ${level}`);
|
||||||
|
|
||||||
const category = `${label.range}: ${
|
const category = `${label.range}: ${
|
||||||
label.ja
|
label.ja
|
||||||
} ${label.en.toLocaleUpperCase()}`;
|
} ${label.en.toLocaleUpperCase()}`;
|
||||||
|
|||||||
@@ -6,6 +6,16 @@ if (require.main === module) {
|
|||||||
// { ja: 'Japanese', audio: 'JapaneseAudio' },
|
// { ja: 'Japanese', audio: 'JapaneseAudio' },
|
||||||
// { mode: { online: true } },
|
// { mode: { online: true } },
|
||||||
// );
|
// );
|
||||||
|
// new WaniKani().populateSentence(
|
||||||
|
// 'note:jp.takoboto',
|
||||||
|
// {
|
||||||
|
// vocabJa: 'Japanese',
|
||||||
|
// sentenceJa: 'Sentence',
|
||||||
|
// sentenceAudio: 'SentenceAudio',
|
||||||
|
// sentenceEn: 'SentenceMeaning',
|
||||||
|
// },
|
||||||
|
// { overwrite: true },
|
||||||
|
// );
|
||||||
new WaniKani().addTags('note:jp.takoboto', {
|
new WaniKani().addTags('note:jp.takoboto', {
|
||||||
ja: 'Japanese',
|
ja: 'Japanese',
|
||||||
});
|
});
|
||||||
|
|||||||
+8
-4
@@ -19,7 +19,7 @@ export class WaniKani {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static getLevelLabel(level: number): ILevelLabel {
|
static getLevelLabel(level: number): ILevelLabel | null {
|
||||||
if (level < 11) {
|
if (level < 11) {
|
||||||
return {
|
return {
|
||||||
range: '01-10',
|
range: '01-10',
|
||||||
@@ -58,7 +58,7 @@ export class WaniKani {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`invalid level: ${level}`);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async subjects({
|
async subjects({
|
||||||
@@ -303,9 +303,13 @@ export class WaniKani {
|
|||||||
>();
|
>();
|
||||||
vocabularies.map((v) => {
|
vocabularies.map((v) => {
|
||||||
if (vocabMap.has(v.data.characters)) return;
|
if (vocabMap.has(v.data.characters)) return;
|
||||||
|
const level = v.data.level;
|
||||||
|
const label = WaniKani.getLevelLabel(level);
|
||||||
|
if (!label) throw new Error(`Invalid level: ${level}`);
|
||||||
|
|
||||||
vocabMap.set(v.data.characters, {
|
vocabMap.set(v.data.characters, {
|
||||||
level: v.data.level,
|
level,
|
||||||
label: WaniKani.getLevelLabel(v.data.level),
|
label,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (!vocabMap.size) return;
|
if (!vocabMap.size) return;
|
||||||
|
|||||||
Reference in new issue
Block a user