add vocabulary to subjects
This commit is contained in:
1 parent
a2e6e66bcf
commit
92c1de3d1f
2 files changed
+90
-43
No files matched your search
@@ -9,14 +9,16 @@ interface ILevelMap {
|
||||
};
|
||||
}
|
||||
|
||||
async function makeWaniKaniKanjiLevels(opts: { cache?: boolean } = {}) {
|
||||
async function makeWaniKaniKanjiLevels(
|
||||
opts: { cache?: boolean; force?: boolean } = {},
|
||||
) {
|
||||
const FILENAME = 'cache/wanikani-kanji.yaml';
|
||||
if (opts.cache && existsSync(FILENAME)) {
|
||||
return yaml.load(readFileSync(FILENAME, 'utf-8')) as ILevelMap;
|
||||
}
|
||||
|
||||
const wkKanji = await new WaniKani()
|
||||
.subjects()
|
||||
.subjects({ force: !!opts.force })
|
||||
.then((vs) => vs.filter((v) => v.object === 'kanji') as IKanji[]);
|
||||
|
||||
const levelMap: ILevelMap = {};
|
||||
|
||||
Reference in new issue
Block a user