MCPcopy Index your code
hub / github.com/OpenSIST/OpenSIST.github.io / getPosts

Function getPosts

src/Data/PostData.js:53–64  ·  view source on GitHub ↗
(query = {})

Source from the content-addressed store, hash-verified

51}
52
53export async function getPosts(query = {}) {
54 const postsResult = await apiJson(LIST_POSTS_API);
55 const searchTerm = query.searchStr?.toLowerCase() ?? "";
56 return [...(postsResult.posts ?? [])].map(normalizePostContent).sort(
57 (a, b) => new Date(b.updated_at ?? b.created_at) - new Date(a.updated_at ?? a.created_at)
58 ).filter(
59 (post) =>
60 (post.title ?? "").toLowerCase().includes(searchTerm) ||
61 (post.author ?? "").toLowerCase().includes(searchTerm) ||
62 post.tags.some((tag) => tag.toLowerCase().includes(searchTerm))
63 );
64}
65
66export async function getPostThread(postId) {
67 try {

Callers 2

loaderFunction · 0.90
StatsBlockFunction · 0.90

Calls 1

apiJsonFunction · 0.90

Tested by

no test coverage detected