update tag
This commit is contained in:
1 parent
16d1307744
commit
292beabffe
3 files changed
+20
-4
No files matched your search
+8
-4
@@ -19,7 +19,7 @@ export class WaniKani {
|
||||
});
|
||||
}
|
||||
|
||||
static getLevelLabel(level: number): ILevelLabel {
|
||||
static getLevelLabel(level: number): ILevelLabel | null {
|
||||
if (level < 11) {
|
||||
return {
|
||||
range: '01-10',
|
||||
@@ -58,7 +58,7 @@ export class WaniKani {
|
||||
};
|
||||
}
|
||||
|
||||
throw new Error(`invalid level: ${level}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
async subjects({
|
||||
@@ -303,9 +303,13 @@ export class WaniKani {
|
||||
>();
|
||||
vocabularies.map((v) => {
|
||||
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, {
|
||||
level: v.data.level,
|
||||
label: WaniKani.getLevelLabel(v.data.level),
|
||||
level,
|
||||
label,
|
||||
});
|
||||
});
|
||||
if (!vocabMap.size) return;
|
||||
|
||||
Reference in new issue
Block a user