From 63fe4b971223b2d74d5d3c14307065d57245a9ef Mon Sep 17 00:00:00 2001 From: Hunter Dougless Date: Wed, 15 Feb 2017 22:29:45 -0500 Subject: [PATCH] Refactor how findProfile is referenced --- index.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index c1e627b..3deebaf 100644 --- a/index.js +++ b/index.js @@ -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); /** @@ -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 @@ -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 *