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

github-username

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-username - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

license

30

index.js
'use strict';
var request = require('request');
var got = require('got');
var querystring = require('querystring');

@@ -22,20 +23,23 @@ module.exports = function (email, token, cb) {

request.get({
url: 'https://api.github.com/search/users',
json: true,
qs: {
q: email + ' in:email'
},
var qs = querystring.stringify({
q: email + ' in:email'
});
got.get('https://api.github.com/search/users?' + qs, {
headers: headers
}, function (err, res, body) {
if (err || res.statusCode !== 200) {
return cb(err || new Error('Status code: ' + res.statusCode));
}, function (err, data) {
if (err) {
cb(err);
return;
}
if (body.total_count === 0) {
return cb(new Error('Couldn\'t find a username for the supplied email'));
data = JSON.parse(data);
if (data.total_count === 0) {
cb(new Error('Couldn\'t find a username for the supplied email'));
return;
}
cb(null, body.items[0].login);
cb(null, data.items[0].login);
});
};
{
"name": "github-username",
"version": "1.0.0",
"version": "1.1.0",
"description": "Get a GitHub username from an email address",

@@ -26,2 +26,3 @@ "license": "MIT",

"keywords": [
"cli-app",
"cli",

@@ -39,3 +40,3 @@ "bin",

"get-stdin": "^1.0.0",
"request": "^2.40.0"
"got": "^2.3.0"
},

@@ -42,0 +43,0 @@ "devDependencies": {

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