mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-10 14:06:34 +00:00
1305a7cd92
BREAKING CHANGE: Drop support for Node < v4. This uses native Promises available from Node v4. * fix: Bump inquirer to v3.0.1. Fixes #33 to improve Windows support. * refactor: Promisify everything as inquirer uses Promises from 1.0.0 onwards
22 lines
486 B
JavaScript
22 lines
486 B
JavaScript
'use strict';
|
|
|
|
var pify = require('pify');
|
|
var request = pify(require('request'));
|
|
|
|
module.exports = function getUserInfo(username) {
|
|
return request.get({
|
|
url: 'https://api.github.com/users/' + username,
|
|
headers: {
|
|
'User-Agent': 'request'
|
|
}
|
|
})
|
|
.then(res => {
|
|
var body = JSON.parse(res.body);
|
|
return {
|
|
login: body.login,
|
|
name: body.name || username,
|
|
avatar_url: body.avatar_url,
|
|
profile: body.blog || body.html_url
|
|
};
|
|
});
|
|
};
|