From ceb7ba750958c50c4aac944a5f200e2376b295eb Mon Sep 17 00:00:00 2001 From: Marvin Scham Date: Tue, 23 Aug 2022 01:47:21 +0200 Subject: [PATCH] Added language names --- basic-example/basic-example.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/basic-example/basic-example.js b/basic-example/basic-example.js index 9462746..082c273 100644 --- a/basic-example/basic-example.js +++ b/basic-example/basic-example.js @@ -6,10 +6,18 @@ fetch(url) .then((out) => { const langInfo = out.lang_data; + const langNames = new Map([ + ["eo", "Esperanto"], + ["en", "Englisch"], + ["ru", "Russisch"], + ["ja", "Japanisch"], + ["es", "Spanisch"] + ]); + let langInfoPrepped = []; Object.entries(langInfo).forEach((el) => { let item = {}; - item["name"] = el[1].learningLanguage; + item["name"] = langNames.get(el[1].learningLanguage); item["count"] = el[1].xp; // Filter irrelevant items