rss-parser
Advanced tools
Comparing version 2.10.5 to 2.10.6
@@ -91,2 +91,5 @@ 'use strict'; | ||
var json = {feed: {entries: []}}; | ||
if(options && options.customFields && options.customFields.feed){ | ||
copyFromXML(feed, json.feed, options.customFields.feed); | ||
} | ||
if (feed.link) { | ||
@@ -104,2 +107,5 @@ if (feed.link[0] && feed.link[0].$.href) json.feed.link = feed.link[0].$.href; | ||
var item = {}; | ||
if(options && options.customFields && options.customFields.item){ | ||
copyFromXML(entry, item, options.customFields.item); | ||
} | ||
if (entry.title) { | ||
@@ -106,0 +112,0 @@ var title = entry.title[0] || ''; |
{ | ||
"name": "rss-parser", | ||
"version": "2.10.5", | ||
"version": "2.10.6", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -111,2 +111,23 @@ "use strict"; | ||
it('should parse Atom feed custom fields', function(done) { | ||
var options = { | ||
customFields: { | ||
feed: ['totalViews'], | ||
item: ['media:group'] | ||
} | ||
}; | ||
Parser.parseFile(__dirname + '/input/atom-customfields.atom',options, function(err, parsed) { | ||
Expect(err).to.equal(null); | ||
var str = JSON.stringify(parsed, null, 2); | ||
var outfile = OUT_DIR + '/atom-customfields.json'; | ||
if (process.env.WRITE_GOLDEN) { | ||
FS.writeFileSync(outfile, str); | ||
} else { | ||
var expected = FS.readFileSync(outfile, 'utf8'); | ||
Expect(str).to.equal(expected); | ||
} | ||
done(); | ||
}); | ||
}); | ||
it('should parse URL', function(done) { | ||
@@ -113,0 +134,0 @@ var server = HTTP.createServer(function(req, res) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
3003247
44
17591
6