Socket
Socket
Sign inDemoInstall

fast-feed

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-feed - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

tests/atom_links.js

64

index.js

@@ -9,2 +9,60 @@ var native = require('./build/Release/parser');

// Finds "best" link for an Atom feed article.
function atomLink(article) {
var link;
var links = article.links;
var best = false;
if (links.length > 0) {
link = links[0];
}
for (var i = 0; i < links.length; i++) {
var l = links[i];
if (l.rel === 'alternate') {
if (l.type === 'text/html') {
link = l;
best = true;
} else if (!best) {
link = l;
}
}
}
article.link = link ? link.href : undefined;
}
// Postprocess a single Atom feed article.
function postProcAtomArticle(article) {
parseDate(article);
atomLink(article);
}
// Postprocess a single RSS 2 feed article.
function postProcRss2Article(article) {
parseDate(article);
}
// Postprocess the whole Atom feed.
function postProcAtom(feed) {
feed.items.forEach(postProcAtomArticle);
}
// Postprocess the whole RSS 2 feed.
function postProcRss2(feed) {
feed.items.forEach(postProcRss2Article);
}
function parseAndPostProc(xml, options) {
var result = native.parse(xml, options.content);
if (result.type === 'atom') {
postProcAtom(result);
} else {
postProcRss2(result);
}
return result;
}
// parse(xml, [options], [cb]).

@@ -30,4 +88,3 @@

try {
result = native.parse(xml, options.content);
result.items.forEach(parseDate);
result = parseAndPostProc(xml, options);
cb(null, result);

@@ -38,6 +95,5 @@ } catch (err) {

} else {
result = native.parse(xml, options.content);
result.items.forEach(parseDate);
result = parseAndPostProc(xml, options);
return result;
}
};

2

package.json
{
"name": "fast-feed",
"version": "0.0.10",
"version": "0.0.11",
"keywords": [

@@ -5,0 +5,0 @@ "rss",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc