Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-rss-parser

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-rss-parser - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

test/samples/rssv2-with-dc.js

4

index.js

@@ -18,3 +18,3 @@ var DOMParser = require('xmldom').DOMParser;

}
let parsedFeed = parser.parse(document);

@@ -39,2 +39,2 @@

return;
}
}
{
"name": "react-native-rss-parser",
"version": "1.3.0",
"version": "1.4.0",
"description": "React Native compatible package to parse RSS feeds",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -143,4 +143,8 @@ var utils = require('./utils');

function getItemAuthors(node) {
const authors = utils.getElementTextContentArray(node, 'author');
let authors = utils.getElementTextContentArray(node, 'author');
if (authors.length === 0) {
authors = utils.getElementTextContentArray(node, 'dc:creator');
}
return authors.map(function(author) {

@@ -154,4 +158,8 @@ return {

function getItemCategories(node) {
const categories = utils.getElementTextContentArray(node, 'category');
let categories = utils.getElementTextContentArray(node, 'category');
if (categories.length === 0) {
categories = utils.getElementTextContentArray(node, 'dc:subject');
}
return categories.map(function(category) {

@@ -169,3 +177,3 @@ return {

function getItemPublished(node) {
return utils.getElementTextContent(node, 'pubDate');
return utils.getElementTextContent(node, 'pubDate') || utils.getElementTextContent(node, 'dc:date');
}

@@ -202,2 +210,2 @@

});
}
}

@@ -5,3 +5,3 @@ # react-native-rss-parser

[![npm version](https://badge.fury.io/js/react-native-rss-parser.svg)](https://badge.fury.io/js/react-native-rss-parser)
[![Build Status](https://api.travis-ci.org/jameslawler/react-native-rss-parser.png?branch=master)](https://api.travis-ci.org/jameslawler/react-native-rss-parser)
[![Build Status](https://api.travis-ci.org/jameslawler/react-native-rss-parser.png?branch=master)](https://travis-ci.org/jameslawler/react-native-rss-parser)

@@ -142,14 +142,14 @@ Parse RSS data into a simple object structure. Currently supports;

| Parsed Value | RSS v2.0 | Atom v1.0 |
| ------------- | --------------- | ------------- |
| id | guid | id |
| title | title | title |
| imageUrl | | icon |
| links | link | link |
| description | description | summary |
| content | content:encoded | content |
| categories | category | category |
| authors | author | contributor |
| published | pubDate | published |
| enclosures | enclosures | link |
| Parsed Value | RSS v2.0 | Atom v1.0 |
| ------------- | --------------- | ------------- |
| id | guid | id |
| title | title | title |
| imageUrl | | icon |
| links | link | link |
| description | description | summary |
| content | content:encoded | content |
| categories | category / dc:subject| category |
| authors | author / dc:creator | contributor |
| published | pubDate / dc:date | published |
| enclosures | enclosures | link |

@@ -179,2 +179,2 @@ ## Development setup

Distributed under the MIT license. See ``LICENSE`` for more information.
Distributed under the MIT license. See ``LICENSE`` for more information.

@@ -8,2 +8,3 @@ var assert = require('assert');

var rssv2WithContent = require('./samples/rssv2-with-content');
var rssv2WithDc = require('./samples/rssv2-with-dc');
var rssParser = require('../index');

@@ -141,2 +142,13 @@

});
describe('with dc:* elements', function() {
it('should return information for dublin core', function() {
return rssParser.parse(rssv2WithDc.feed)
.then((result) => {
assert.equal(result.items[0].published, 'Sun, 29 Sep 2002 17:05:20 GMT');
assert.equal(result.items[0].categories[0].name, 'channel-category');
assert.equal(result.items[0].authors[0].name, 'dave@userland.com');
});
});
});
});
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