mirror of
https://github.com/Fluffy-Bean/website.git
synced 2024-12-28 02:16:10 +00:00
refactor: replace short hand type conversions with function calls
Prefer using explicit casts by calling `Number`, `Boolean`, or `String` over using operators like `+`, `!!` or `"" +`. This is considered best practice as it improves readability.
This commit is contained in:
parent
b99142fd44
commit
5228c0e1d0
|
@ -6,6 +6,6 @@ export async function getPosts(collection: keyof ContentEntryMap) {
|
|||
return data.draft !== true
|
||||
})
|
||||
return posts.sort((a, b) =>
|
||||
a.data.pubDate && b.data.pubDate ? +b.data.pubDate - +a.data.pubDate : 0
|
||||
a.data.pubDate && b.data.pubDate ? Number(b.data.pubDate) - Number(a.data.pubDate) : 0
|
||||
)
|
||||
}
|
Loading…
Reference in a new issue