(query: string)
| 96 | } |
| 97 | |
| 98 | export function getMatchingPosts(query: string) { |
| 99 | const words = query.split(' ').map((w) => w.trim()) |
| 100 | return blogPosts.filter((post) => { |
| 101 | if (!query) return true |
| 102 | return ( |
| 103 | words.every((word) => post.tags.some((tag) => tag === word)) || |
| 104 | post.title.toLowerCase().includes(query.toLowerCase()) || |
| 105 | post.description.toLowerCase().includes(query.toLowerCase()) |
| 106 | ) |
| 107 | }) |
| 108 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…