message: Code Improvement:
  Using inline if
diff: @@ -127,10 +127,7 @@ module.exports = function(bot, config) {
  * @param {function} cb A NodeJS-style callback
  */
  slack_api.callAPI = function(command, data, cb, multipart) {
  - if (!data.token) {
  - data.token = config.token;
  - }
  -
  + data.token = data.token ? data.token : config.token;
  bot.debug(command, data);
  postForm(slack_api.api_url + command, data, cb, multipart);
  };
  @@ -143,16 +140,9 @@ module.exports = function(bot, config) {
  * @param {function} cb A NodeJS-style callback
  */
  slack_api.callAPIWithoutToken = function(command, data, cb) {
  - if (!data.client_id) {
  - data.client_id = bot.config.clientId;
  - }
  - if (!data.client_secret) {
  - data.client_secret = bot.config.clientSecret;
  - }
  - if (!data.redirect_uri) {
  - data.redirect_uri = bot.config.redirectUri;
  - }
  -
  + data.client_id = data.client_id ? data.client_id : bot.config.clientId;
  + data.client_secret = data.client_secret ? data.client_secret : bot.config.clientSecret;
  + data.redirect_uri = data.redirect_uri ? data.redirect_uri : bot.config.redirectUri;
  // DON'T log options: that could expose the client secret!
  postForm(slack_api.api_url + command, data, cb);
  };
  @@ -170,9 +160,7 @@ module.exports = function(bot, config) {
  var currentGroup = slack_api;
  groups.forEach(function(nextGroupName) {
  - if (!currentGroup[nextGroupName]) {
  - currentGroup[nextGroupName] = {};
  - }
  + currentGroup[nextGroupName] = currentGroup[nextGroupName] ? currentGroup[nextGroupName] : {};
  currentGroup = currentGroup[nextGroupName];
  });
  @@ -195,11 +183,7 @@ module.exports = function(bot, config) {
  // specify that files get uploaded using multipart
  slack_api.files.upload = function(options, cb) {
  - if (options.file) {
  - slack_api.callAPI('files.upload', options, cb, true);
  - } else {
  - slack_api.callAPI('files.upload', options, cb, false);
  - }
  + slack_api.callAPI('files.upload', options, cb, !!options.file);
  };
  function sanitizeOptions(options) {
  @@ -251,10 +235,7 @@ module.exports = function(bot, config) {
  return cb(parseError);
  }
  - if (json.ok) {
  - return cb(null, json);
  - }
  - return cb(json.error, json);
  + return cb((json.ok ? null : json.error), json);
  }
  return cb(error || new Error('Invalid response'));
  });
  