diff --git a/lib/main.js b/lib/main.js index 21d99e3e..b0494551 100644 --- a/lib/main.js +++ b/lib/main.js @@ -521,20 +521,19 @@ Lambda.prototype.package = function (program) { var _this = this; if (!program.packageDirectory) { throw 'packageDirectory not specified!'; - } else { - try { - var isDir = fs.lstatSync(program.packageDirectory).isDirectory(); + } + try { + var isDir = fs.lstatSync(program.packageDirectory).isDirectory(); - if (!isDir) { - throw program.packageDirectory + ' is not a directory!'; - } - } catch(err) { - if (err.code === 'ENOENT') { - console.log('=> Creating package directory'); - fs.mkdirsSync(program.packageDirectory); - } else { - throw err; - } + if (!isDir) { + throw program.packageDirectory + ' is not a directory!'; + } + } catch(err) { + if (err.code === 'ENOENT') { + console.log('=> Creating package directory'); + fs.mkdirsSync(program.packageDirectory); + } else { + throw err; } } @@ -604,15 +603,14 @@ Lambda.prototype.deploy = function (program) { return _this._uploadNew(lambda, params, function(err, results) { if (err) { throw err; - } else { - console.log('=> Zip file(s) done uploading. Results follow: '); - console.log(results); - - // Updating event source(s) - _this._updateEventSources(lambda, params.FunctionName, [], eventSourceList, function(err, results) { - cb(null, results); - }); } + console.log('=> Zip file(s) done uploading. Results follow: '); + console.log(results); + + // Updating event source(s) + _this._updateEventSources(lambda, params.FunctionName, [], eventSourceList, function(err, results) { + cb(null, results); + }); }); } else { _this._listEventSourceMappings(lambda, { @@ -620,38 +618,35 @@ Lambda.prototype.deploy = function (program) { }, function(err, existingEventSourceList) { if (err) { throw err; - } else { - return async.parallel([ - function(_callback) { - _this._uploadExisting(lambda, params, function(err, results) { - if (err) { - throw err; - } else { - console.log('=> Zip file(s) done uploading. Results follow: '); - console.log(results); - _callback(err, results); - } - }) - }, - function(_callback) { - _this._updateEventSources(lambda, params.FunctionName, existingEventSourceList, eventSourceList, function(err, results) { - _callback(err, results) - }) - } - ], function(err, results) { - cb(err, results); - }); } + return async.parallel([ + function(_callback) { + _this._uploadExisting(lambda, params, function(err, results) { + if (err) { + throw err; + } + console.log('=> Zip file(s) done uploading. Results follow: '); + console.log(results); + _callback(err, results); + }) + }, + function(_callback) { + _this._updateEventSources(lambda, params.FunctionName, existingEventSourceList, eventSourceList, function(err, results) { + _callback(err, results) + }) + } + ], function(err, results) { + cb(err, results); + }); }); } }); }, function (err, results) { if (err) { throw err; - } else { - console.log('=> All tasks done. Results follow: '); - console.log(results); } + console.log('=> All tasks done. Results follow: '); + console.log(results); }); }); };