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

xast-util-feed

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xast-util-feed - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

index.d.ts

44

package.json
{
"name": "xast-util-feed",
"version": "1.0.0",
"version": "1.1.0",
"description": "xast utility to build feeds (rss, atom)",

@@ -28,15 +28,19 @@ "license": "MIT",

],
"sideEffects": false,
"type": "module",
"main": "./index.mjs",
"module": "./index.mjs",
"main": "index.js",
"types": "index.d.ts",
"files": [
"lib/",
"index.mjs"
"index.d.ts",
"index.js"
],
"dependencies": {
"@types/xast": "^1.0.0",
"bcp-47-normalize": "^1.0.0",
"unist-builder": "^2.0.0",
"xastscript": "^2.0.0"
"unist-builder": "^3.0.0",
"xastscript": "^3.0.0"
},
"devDependencies": {
"@types/tape": "^4.0.0",
"c8": "^7.0.0",

@@ -48,11 +52,16 @@ "concat-stream": "^2.0.0",

"remark-preset-wooorm": "^8.0.0",
"rimraf": "^3.0.0",
"tape": "^5.0.0",
"xast-util-to-xml": "^2.0.0",
"xo": "^0.37.0"
"type-coverage": "^2.0.0",
"typescript": "^4.0.0",
"xast-util-to-xml": "^3.0.0",
"xo": "^0.39.0"
},
"scripts": {
"prepack": "npm run build && npm run format",
"build": "rimraf \"{lib/**,}*.d.ts\" && tsc && type-coverage",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"test-api": "node test.mjs",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node --experimental-modules test.mjs",
"test": "npm run format && npm run test-coverage"
"test-api": "node test.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js",
"test": "npm run build && npm run format && npm run test-coverage"
},

@@ -69,6 +78,2 @@ "prettier": {

"prettier": true,
"esnext": false,
"extensions": [
"mjs"
],
"rules": {

@@ -83,3 +88,5 @@ "complexity": "off",

],
"no-eq-null": "off"
"no-eq-null": "off",
"no-var": "off",
"prefer-arrow-callback": "off"
}

@@ -91,3 +98,8 @@ },

]
},
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true
}
}

@@ -28,7 +28,7 @@ # xast-util-feed

Note that this package is ESM only: Node 12+ is required to use it and it must
be imported instead of required.
## Install
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c):
Node 12+ is needed to use it and it must be `import`ed instead of `require`d.
[npm][]:

@@ -42,33 +42,33 @@

Say we have the following module, `example.mjs`
Say we have the following module, `example.js`
```js
import {rss} from 'xast-util-feed'
import toXml from 'xast-util-to-xml'
import {atom, rss} from 'xast-util-feed'
import {toXml} from 'xast-util-to-xml'
var tree = rss(
var channel = {
title: 'NYT > Top Stories',
url: 'https://www.nytimes.com',
feedUrl: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml',
lang: 'en',
author: 'The New York Times Company'
}
var data = [
{
title: 'NYT > Top Stories',
url: 'https://www.nytimes.com',
feedUrl: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml',
lang: 'en',
author: 'The New York Times Company'
},
[
{
title: 'Senate Balances Impeachment Trial With an Incoming President',
url:
'https://www.nytimes.com/2021/01/14/us/politics/impeachment-senate-trial-trump.html',
description: 'Senate leaders etc etc etc.',
author: 'Nicholas Fandos and Catie Edmondson',
published: 'Fri, 15 Jan 2021 01:18:49 +0000',
tags: ['Senate', 'Murkowski, Lisa', 'Trump, Donald J']
}
]
)
title: 'Senate Balances Impeachment Trial With an Incoming President',
url:
'https://www.nytimes.com/2021/01/14/us/politics/impeachment-senate-trial-trump.html',
descriptionHtml: '<p>Senate leaders etc etc etc.</p>',
author: 'Nicholas Fandos and Catie Edmondson',
published: 'Fri, 15 Jan 2021 01:18:49 +0000',
tags: ['Senate', 'Murkowski, Lisa', 'Trump, Donald J']
}
]
console.log(toXml(tree))
console.log(toXml(rss(channel, data)))
console.log(toXml(atom(channel, data)))
```
Now, running `node example.mjs` yields (pretty printed):
Now, running `node example.js` yields (pretty printed):

@@ -82,5 +82,5 @@ ```xml

<link>https://www.nytimes.com/</link>
<lastBuildDate>Fri, 15 Jan 2021 11:38:12 GMT</lastBuildDate>
<dc:date>2021-01-15T11:38:12.052Z</dc:date>
<atom:link href="https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml" rel="self" type="application/rss+xml" />
<lastBuildDate>Sun, 17 Jan 2021 09:00:54 GMT</lastBuildDate>
<dc:date>2021-01-17T09:00:54.781Z</dc:date>
<atom:link href="https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml" rel="self" type="application/rss+xml"></atom:link>
<language>en</language>

@@ -100,3 +100,3 @@ <dc:language>en</dc:language>

<category>Trump, Donald J</category>
<description>Senate leaders etc etc etc.</description>
<description>&#x3C;p>Senate leaders etc etc etc.&#x3C;/p></description>
</item>

@@ -107,4 +107,36 @@ </channel>

```xml
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title>NYT > Top Stories</title>
<subtitle></subtitle>
<link>https://www.nytimes.com/</link>
<id>https://www.nytimes.com/</id>
<updated>Sun, 17 Jan 2021 09:00:54 GMT</updated>
<link href="https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml" rel="self" type="application/atom+xml"></link>
<rights>© 2021 The New York Times Company</rights>
<author>
<name>The New York Times Company</name>
</author>
<category term="Senate"></category>
<category term="Murkowski, Lisa"></category>
<category term="Trump, Donald J"></category>
<entry>
<title>Senate Balances Impeachment Trial With an Incoming President</title>
<author>
<name>Nicholas Fandos and Catie Edmondson</name>
</author>
<link href="https://www.nytimes.com/2021/01/14/us/politics/impeachment-senate-trial-trump.html"></link>
<id>https://www.nytimes.com/2021/01/14/us/politics/impeachment-senate-trial-trump.html</id>
<published>2021-01-15T01:18:49.000Z</published>
<content type="html">&#x3C;p>Senate leaders etc etc etc.&#x3C;/p></content>
</entry>
</feed>
```
## API
This package exports the following identifiers: `atom`, `rss`.
There is no default export.
### `rss(channel, data)`

@@ -234,3 +266,3 @@

— Full URL to the resource
* `length` (`number`, example: `24986239`)
* `size` (`number`, example: `24986239`)
— Resource size in bytes

@@ -237,0 +269,0 @@ * `type` (`string`, example: `'audio/mpeg'`)

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