Socket
Socket
Sign inDemoInstall

hack-news

Package Overview
Dependencies
0
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.3 to 2.0.4

24

index.js

@@ -221,1 +221,25 @@ const https = require('https');

}
//get all changed items and profiles
exports.changedItemsAndProfiles = function (callback) {
callback = callback || () => {};
return new Promise((resolve, reject) => {
https.get('https://hacker-news.firebaseio.com/v0/updates.json?print=pretty', (res) => {
res.on('data', (d) => {
const stories = JSON.parse(d, (key, value) => {
return value && value.type === 'Buffer'
? new Buffer(value.data)
: value;
});
resolve(stories);
callback(null, stories);
});
}).on('error', (e) => {
reject(e);
callback(e, null);
});
});
}

2

package.json
{
"name": "hack-news",
"version": "2.0.3",
"version": "2.0.4",
"description": "A simple library of methods to help you interact with the Hacker News API. There's more on the way.",

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

@@ -198,2 +198,20 @@ ## Installation

####Changed items and profiles
The examples below show how to access the changed or updated items and profiles on Hacker News.
```javascript
var hn = require('hack-news');
//This will return a object with two properties, one for the items and another for the profiles.
hn.changedItemsAndProfiles( (error, itemsProfiles) => {
if (error) {
console.log(error);
}
console.log(itemsProfiles);
});
//Using Promises
hn.changedItemsAndProfiles().then(itemsProfiles => {console.log(itemsProfiles);});
```
This is it for now but stay tuned I will be adding a lot more.
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc