Merge pull request #3 from Fluffy-Bean/deepsource-autofix-5ee39c17

refactor: replace short hand type conversions with function calls
This commit is contained in:
Michał 2024-05-25 11:10:59 +01:00 committed by GitHub
commit 147ce62869
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,9 +3,11 @@ import { type ContentEntryMap, getCollection } from "astro:content";
// https://github.com/hellotham/hello-astro/blob/e05706cf488bcec6e4c5494a622eedfc4e47d763/src/config.ts#L55C1-L62C2
export async function getPosts(collection: keyof ContentEntryMap) {
const posts = await getCollection(collection, ({ data }) => {
return data.draft !== true
})
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,
);
}