Browse Source

Parse some fields off each item

master
Hamcha 3 years ago
parent
commit
28788c8fc0
  1. 6
      src/store/feed.ts
  2. 4
      src/store/types.ts

6
src/store/feed.ts

@ -3,6 +3,10 @@ import { Item } from "rss-parser";
export function toEvent(item: Item): FeedEventData {
return {
guid: item.guid || item.link || item.title || Math.random().toString(32)
guid: item.guid || item.link || item.title || Math.random().toString(32),
title: item.title || "Unnamed event",
link: item.link,
creator: item.creator || "Unknown",
published: item.pubDate ? new Date(item.pubDate) : undefined
};
}

4
src/store/types.ts

@ -21,6 +21,10 @@ export interface FeedEvent {
export interface FeedEventData {
guid: string;
title: string;
link?: string;
creator: string;
published?: Date;
}
export interface FetchStatus {

Loading…
Cancel
Save