Skip to content

Commit

Permalink
feat(lib): create separatePostsByStatus function
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 committed May 20, 2023
1 parent 0429780 commit 080bcfc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/separatePostsByStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Post } from 'contentlayer/generated'

export function separatePostsByStatus(posts: Post[]) {
const publishedPosts = posts.filter(post => post.status === 'published')
const draftPosts = posts.filter(post => post.status === 'draft')
const plannedPosts = posts.filter(post => post.status === 'planned')

return { publishedPosts, draftPosts, plannedPosts }
}

0 comments on commit 080bcfc

Please sign in to comment.