New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-ghapi

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-ghapi - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

45

GitHubAPI.js

@@ -1,2 +0,2 @@

var { getJSON } = require('./utils');
var { getJSON, getOptions } = require('./utils');

@@ -21,15 +21,7 @@ var baseURL = 'api.github.com';

repo: (owner, name, callback) => {
getJSON({
host: baseURL,
port: 443,
path: `/repos/${owner}/${name}`,
method: 'GET',
headers: {
'Content-Type': 'application/json',
'User-Agent': 'ghapi-npm'
}
}, (status, repo) => {
getJSON(getOptions(`/repo/${owner}/${name}`), (status, repo) => {
callback(repo);
});
},
/**

@@ -49,15 +41,26 @@ * user: Returns a user JSON object

user: (user, callback) => {
getJSON({
host: baseURL,
port: 443,
path: `/users/${user}`,
method: 'GET',
headers: {
'Content-Type': 'application/json',
'User-Agent': 'ghapi-npm'
}
}, (status, user) => {
getJSON(getOptions(`/user/${user}`), (status, user) => {
callback(user);
});
},
/**
* commits: Returns a JSON object populated with commits.
* @function
* @public
*
* @param {string} owner The owner of the repo.
* @param {string} name The name of the repo.
* @param {function} callback The callback with the results.
*
* @example
* commits('haydennyyy', (res) => {
* console.log(res);
* });
*/
commits: (owner, name, callback) => {
getJSON(getOptions(`/repos/${owner}/${name}/commits`), (status, commits) => {
callback(commits);
});
}
}
{
"name": "node-ghapi",
"version": "0.1.2",
"version": "0.2.0",
"description": "A predictable GitHub API wrapper for NodeJS.",

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

@@ -31,3 +31,22 @@ var http = require('http');

req.end();
},
/**
* getOptions: Provides a JSON object containing options.
* @param {string} APIPath The path you're connecting to on GitHub
*
* @example
* getOptions('/users/haydennyyy/ghapi')
*/
getOptions: (APIPath) => {
return {
host: 'api.github.com',
port: 443,
path: APIPath,
method: 'GET',
headers: {
'Content-Type': 'application/json',
'User-Agent': 'ghapi-npm'
}
}
}
}
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