Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor profile parsing.

  • Loading branch information...
commit 0cb0209db6ca849ed2b0840b0dbfc6eb4c6719c1 1 parent 7c8b9a3
Jared Hanson authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 lib/profile.js
21 lib/profile.js
View
@@ -0,0 +1,21 @@
+/**
+ * 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.displayName = json.name;
+ profile.username = json.login;
+ profile.profileUrl = json.html_url;
+ profile.emails = [{ value: json.email }];
+
+ return profile;
+};
Please sign in to comment.
Something went wrong with that request. Please try again.