fix: bug where wakatime api returns undefined languages (#1403)

Co-authored-by: Markus Tyrkkö <markus.tyrkko@nitor.com>
This commit is contained in:
Markus Tyrkkö
2021-11-05 19:49:51 +05:30
committed by GitHub
co-authored by Markus Tyrkkö
parent bc6c22ea17
commit 28fa0b8877
2 changed files with 10 additions and 2 deletions
+2 -2
View File
@@ -123,7 +123,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
} = options;
const shouldHideLangs = Array.isArray(hide) && hide.length > 0;
if (shouldHideLangs) {
if (shouldHideLangs && languages !== undefined) {
const languagesToHide = new Set(hide.map((lang) => lowercaseTrim(lang)));
languages = languages.filter(
(lang) => !languagesToHide.has(lowercaseTrim(lang.name)),
@@ -138,7 +138,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
const lheight = parseInt(line_height, 10);
langsCount = clampValue(parseInt(langs_count), 1, langs_count);
const langsCount = clampValue(parseInt(langs_count), 1, langs_count);
// returns theme based colors with proper overrides and defaults
const {