1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import { PostMetadata } from '@/utils/types';
function parsePostMetadata(lines: string[]): PostMetadata[] { const result: PostMetadata[] = []; for (let line of lines) { const obj = JSON.parse(line); if (obj.type !== "metadata") { continue; } result.push({ title: obj.title, description: obj.description, author: obj.author, date: new Date(obj.date), }); } return result; }
Contextual suggestions
Supermaven finds the definition of PostMetadata elsewhere in the codebase and uses it to provide the right suggestions.