Skip to content

Commit cfa6e5b

Browse files
changed undefined to null
1 parent 03b6e87 commit cfa6e5b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/widget/widget.service.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class WidgetService {
6161
this.apiService.getActivity(process.env.ACTIVITY_API, process.env.ACTIVITY_ID)
6262
]);
6363

64-
const top_repos = github_data.data.user?.repositories?.nodes?.slice(0, 3)?.reduce((acc, value) => {
64+
const top_repos = github_data.data.user?.repositories?.nodes?.reduce((acc, value) => {
6565
const el = { [value.name]: value.stargazerCount };
6666
acc = { ...acc, ...el };
6767
return acc;
@@ -74,16 +74,16 @@ export class WidgetService {
7474
}, {});
7575

7676
json = {
77-
name: github_data.data.user?.name ?? 'n/a',
77+
name: github_data.data.user?.name ?? null,
7878
description: process.env.DESCRIPTION,
7979
github: {
80-
followers: github_data.data.user?.followers?.totalCount,
81-
total_stars: github_data.data.user?.repositories?.totalCount,
82-
top_repos: top_repos,
80+
followers: github_data.data.user?.followers?.totalCount ?? null,
81+
total_stars: github_data.data.user?.repositories?.totalCount ?? null,
82+
top_repos: top_repos ?? null,
8383
streak: streak ? {
8484
current: streak.streak,
8585
longest: streak.longest
86-
} : undefined,
86+
} : null,
8787
},
8888
wakatime: {
8989
all_time: wakatime_global?.data?.grand_total?.human_readable_total_including_other_language,
@@ -92,7 +92,7 @@ export class WidgetService {
9292
weather: weather ? {
9393
temperature: weather.temp,
9494
condition: weather.condition
95-
} : undefined,
95+
} : null,
9696
datetime: {
9797
time: this.getTime(),
9898
tz: process.env.DATETIME_TIMEZONE,
@@ -102,7 +102,7 @@ export class WidgetService {
102102
file: activity.activities[0].file ?? 'Idling',
103103
workplace: activity.activities[0].workplace ?? 'No workplace',
104104
duration: this.getTimeDiff(new Date(activity.activities[0].start_time))
105-
} : undefined,
105+
} : null,
106106
created_by: "AndcoolSystems"
107107
}
108108
} catch (e) {

0 commit comments

Comments
 (0)