From a03ceb5d8d69f7b1263aeb256d8398f562398e5f Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 1 Nov 2020 19:39:42 +0000 Subject: [PATCH] fix(core): update --- ts/index.ts | 49 ++----------------------------- ts/smartfeed.classes.smartfeed.ts | 47 +++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 47 deletions(-) create mode 100644 ts/smartfeed.classes.smartfeed.ts diff --git a/ts/index.ts b/ts/index.ts index 9a5b2e5..bbc959f 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,47 +1,2 @@ -import { Feed, IFeedOptions } from './smartfeed.classes.feed'; -import * as plugins from './smartfeed.plugins'; - -export class Smartfeed { - public createFeed(optionsArg: IFeedOptions) { - const feedVersion = new Feed(optionsArg); - return feedVersion; - } - - /** - * creates a feed from a standardized article object (@tsclass/tsclass).content.IArticle - */ - public async createFeedFromArticleArray(optionsArg: IFeedOptions, articleArray: plugins.tsclass.content.IArticle[]): Promise { - const feed = this.createFeed(optionsArg); - for (const article of articleArray) { - feed.addItem({ - authorName: `${article.author.firstName} ${article.author.surName}`, - timestamp: article.timestamp, - imageUrl: article.featuredImageUrl, - title: article.title, - url: article.url - }); - } - const feedXmlString = feed.exportRssFeedString(); - return feedXmlString; - } - - /** - * allows the parsing of a rss feed string - * @param rssFeedString - */ - public async parseFeedFromString(rssFeedString: string) { - const parser = new plugins.rssParser(); - const resultingFeed = await parser.parseString(rssFeedString); - return resultingFeed; - } - - /** - * allows the parsing of a feed from urls - * @param urlArg - */ - public async parseFeedFromUrl(urlArg: string) { - const parser = new plugins.rssParser(); - const resultingFeed = await parser.parseURL(urlArg); - return resultingFeed; - } -} \ No newline at end of file +export * from './smartfeed.classes.smartfeed'; +export * from './smartfeed.classes.feed'; diff --git a/ts/smartfeed.classes.smartfeed.ts b/ts/smartfeed.classes.smartfeed.ts new file mode 100644 index 0000000..9a5b2e5 --- /dev/null +++ b/ts/smartfeed.classes.smartfeed.ts @@ -0,0 +1,47 @@ +import { Feed, IFeedOptions } from './smartfeed.classes.feed'; +import * as plugins from './smartfeed.plugins'; + +export class Smartfeed { + public createFeed(optionsArg: IFeedOptions) { + const feedVersion = new Feed(optionsArg); + return feedVersion; + } + + /** + * creates a feed from a standardized article object (@tsclass/tsclass).content.IArticle + */ + public async createFeedFromArticleArray(optionsArg: IFeedOptions, articleArray: plugins.tsclass.content.IArticle[]): Promise { + const feed = this.createFeed(optionsArg); + for (const article of articleArray) { + feed.addItem({ + authorName: `${article.author.firstName} ${article.author.surName}`, + timestamp: article.timestamp, + imageUrl: article.featuredImageUrl, + title: article.title, + url: article.url + }); + } + const feedXmlString = feed.exportRssFeedString(); + return feedXmlString; + } + + /** + * allows the parsing of a rss feed string + * @param rssFeedString + */ + public async parseFeedFromString(rssFeedString: string) { + const parser = new plugins.rssParser(); + const resultingFeed = await parser.parseString(rssFeedString); + return resultingFeed; + } + + /** + * allows the parsing of a feed from urls + * @param urlArg + */ + public async parseFeedFromUrl(urlArg: string) { + const parser = new plugins.rssParser(); + const resultingFeed = await parser.parseURL(urlArg); + return resultingFeed; + } +} \ No newline at end of file