From 66bd370f34a12dd0a1bdf257a5690c1ae6f0a1da Mon Sep 17 00:00:00 2001 From: Ariful Alam Date: Mon, 18 Jul 2022 12:40:51 +0600 Subject: [PATCH] Refactor utils.jsx --- src/helpers/utils.jsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/helpers/utils.jsx b/src/helpers/utils.jsx index a1fe245..5c58d0b 100644 --- a/src/helpers/utils.jsx +++ b/src/helpers/utils.jsx @@ -136,11 +136,11 @@ export const sanitizeConfig = (config) => { return { github: { - username: config.github.username, - sortBy: config.github.sortBy || 'stars', - limit: config.github.limit || 8, + username: config?.github?.username || '', + sortBy: config?.github?.sortBy || 'stars', + limit: config?.github?.limit || 8, exclude: { - forks: config?.github?.exclude?.forks, + forks: config?.github?.exclude?.forks || false, projects: config?.github?.exclude?.projects || [], }, }, @@ -174,8 +174,9 @@ export const sanitizeConfig = (config) => { }, themeConfig: { defaultTheme: config?.themeConfig?.defaultTheme || themes[0], - disableSwitch: config?.themeConfig?.disableSwitch, - respectPrefersColorScheme: config?.themeConfig?.respectPrefersColorScheme, + disableSwitch: config?.themeConfig?.disableSwitch || false, + respectPrefersColorScheme: + config?.themeConfig?.respectPrefersColorScheme || false, themes: themes, customTheme: customTheme, },