From 5228c0e1d050b1e9455fbd41f560c366ea2f188e Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sat, 25 May 2024 10:10:15 +0000 Subject: [PATCH] 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. --- src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index 141ddde..68293a7 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -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 ) } \ No newline at end of file