recoder-code
Version:
🚀 AI-powered development platform - Chat with 32+ models, build projects, automate workflows. Free models included!
27 lines (25 loc) • 560 B
JavaScript
/**
* Parse profile.
*
* @param {Object|String} json
* @return {Object}
* @api private
*/
exports.parse = function(json) {
if ('string' == typeof json) {
json = JSON.parse(json);
}
var profile = {};
profile.id = String(json.id);
profile.nodeId = json.node_id;
profile.displayName = json.name;
profile.username = json.login;
profile.profileUrl = json.html_url;
if (json.email) {
profile.emails = [{ value: json.email }];
}
if (json.avatar_url) {
profile.photos = [{ value: json.avatar_url }];
}
return profile;
};