-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: hackernews #206
Conversation
aldy505
commented
Nov 12, 2023
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
Co-authored-by: Dicha Zelianivan Arkana <[email protected]>
src/services/hackernews/index.js
Outdated
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
baiklah