Skip to content

Commit

Permalink
Refactor how findProfile is referenced
Browse files Browse the repository at this point in the history
  • Loading branch information
hntrdglss committed Feb 16, 2017
1 parent b5be999 commit 63fe4b9
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ module.exports = function (config, deps) {
config.metricsSource = config.metricsSource.replace(/-/g, ' ');

var common = require('./lib/common.js')(config, deps);
var confirm = require('./confirm.js')( common, {superagent:superagent, findProfile: function (userId, cb) {
findMetadata(userId, 'profile', cb);
}});
var confirm = require('./confirm.js')( common, {superagent:superagent, findProfile: findProfile});
var user = require('./user.js')( common, config, deps);

/**
Expand Down Expand Up @@ -88,6 +86,17 @@ module.exports = function (config, deps) {
common.doGetWithToken('/metadata/' + userId + '/' + type, cb);
}

/**
* Find a user's profile
*
* @param {String} userId id of the user you are finding the profile of
* @param cb
* @returns {cb} cb(err, response)
*/
function findProfile (userId, cb) {
findMetadata(userId, 'profile', cb);
}

return {
/**
* Do any requied initialization
Expand Down Expand Up @@ -236,9 +245,7 @@ module.exports = function (config, deps) {
* @param cb
* @returns {cb} cb(err, response)
*/
findProfile: function (userId, cb) {
findMetadata(userId, 'profile', cb);
},
findProfile: findProfile,
/**
* Find a user's settings
*
Expand Down

0 comments on commit 63fe4b9

Please sign in to comment.