@shaai/core
Advanced tools
Comparing version 0.5.0 to 0.5.1
'use strict'; | ||
var feedAttrs = [{ | ||
name: 'title', | ||
feedKey: 'title' | ||
}, { | ||
name: 'link', | ||
feedKey: 'link' | ||
}, { | ||
name: 'guid', | ||
feedKey: 'guid' | ||
}, { | ||
name: 'author', | ||
feedKey: 'dc:creator' | ||
}, { | ||
name: 'publishData', | ||
feedKey: 'pubDate' | ||
}, { | ||
name: 'content', | ||
feedKey: 'content:encoded' | ||
}]; | ||
var getItems = function getItems(rssFeed) { | ||
var feedAttrs = ['title', 'link', 'guid', 'dc:creator', 'pubDate', 'content:encoded']; | ||
var itemExtractor = function itemExtractor(feedItem, tagName) { | ||
return feedItem.match(new RegExp('(<' + tagName + '[^>]*>(.|\n)*?</' + tagName + '>)', 'gm'))[0].replace(new RegExp('(<' + tagName + '[^>]*>|</' + tagName + '>)', 'gm'), '').replace(new RegExp('(<!\\[CDATA\\[|\\]\\]>)', 'gm'), ''); | ||
var itemExtractor = function itemExtractor(feedItem, feedKey) { | ||
return feedItem.match(new RegExp('(<' + feedKey + '[^>]*>(.|\n)*?</' + feedKey + '>)', 'gm'))[0].replace(new RegExp('(<' + feedKey + '[^>]*>|</' + feedKey + '>)', 'gm'), '').replace(new RegExp('(<!\\[CDATA\\[|\\]\\]>)', 'gm'), ''); | ||
}; | ||
@@ -14,3 +32,3 @@ | ||
feedAttrs.map(function (item) { | ||
return obj[item] = itemExtractor(feedItem, item); | ||
return obj[item.name] = itemExtractor(feedItem, item.feedKey); | ||
}); | ||
@@ -17,0 +35,0 @@ return obj; |
{ | ||
"name": "@shaai/core", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "A blogging npm", | ||
@@ -5,0 +5,0 @@ "main": "dist/es5/lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6352
113