Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: hackernews #206

Merged
merged 5 commits into from
Nov 15, 2023
Merged

feat: hackernews #206

merged 5 commits into from
Nov 15, 2023

Conversation

aldy505
Copy link
Member

@aldy505 aldy505 commented Nov 12, 2023

image
image

@aldy505 aldy505 added the enhancement New feature or request label Nov 12, 2023
Copy link

codecov bot commented Nov 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0970fd1) 78.93% compared to head (42918ed) 78.93%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #206   +/-   ##
=======================================
  Coverage   78.93%   78.93%           
=======================================
  Files          26       26           
  Lines        1619     1619           
=======================================
  Hits         1278     1278           
  Misses        341      341           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/services/hackernews/index.js Outdated Show resolved Hide resolved
Comment on lines 46 to 54
const item = await getItem(story);
// We only want stories. Not job, comment, or poll
if (item?.type !== "story") continue;
// We only want stories that's high in rating
if (item?.score < 100) continue;
// It's useless if it's dead.
if (item?.dead) continue;
// We don't want old stories to come up. Limit this to last 24 hours.
if (item?.time && (item.time * 1000) < last24Hours.getTime()) continue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kalo item null / undefined langsung continue aja, biar ngga kebanyakan optional chaining

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

field nya yang mungkin null. item nggak mungkin null.

Copy link
Member

@elianiva elianiva Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tapi item?.type implies item itu bisa null atau undefined

kalo emang item ga bisa null, mestinya ga perlu optional chaining

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

baiklah

@elianiva elianiva merged commit 7433c8b into master Nov 15, 2023
5 checks passed
@elianiva elianiva deleted the feat/hackernews branch November 15, 2023 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants