From ae8a19d568921b616ea4aec8ed18f0e48d080cce Mon Sep 17 00:00:00 2001 From: Dave Eddy Date: Tue, 1 Sep 2015 15:03:52 -0400 Subject: [PATCH] quick jsstyle cleanup --- lib/cloudapi2.js | 6 +++--- lib/config.js | 2 +- lib/do_packages.js | 2 +- lib/do_wait_instance.js | 4 ++-- lib/triton.js | 3 ++- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/cloudapi2.js b/lib/cloudapi2.js index 63de417..5b68405 100644 --- a/lib/cloudapi2.js +++ b/lib/cloudapi2.js @@ -203,7 +203,7 @@ CloudAPI.prototype._path = function _path(subpath /*, qparams, ... */) { */ CloudAPI.prototype._request = function _request(options, callback) { var self = this; - if (typeof options === 'string') + if (typeof (options) === 'string') options = {path: options}; assert.object(options, 'options'); assert.func(callback, 'callback'); @@ -213,8 +213,8 @@ CloudAPI.prototype._request = function _request(options, callback) { assert.ok(['get', 'post', 'delete', 'head'].indexOf(method) >= 0, 'invalid method given'); switch (method) { - case 'delete': - method = 'del'; + case 'delete': + method = 'del'; break; default: break; diff --git a/lib/config.js b/lib/config.js index 6624da1..a62794e 100755 --- a/lib/config.js +++ b/lib/config.js @@ -37,7 +37,7 @@ function loadConfigSync(opts) { c = fs.readFileSync(opts.configPath, 'utf8'); var _user = JSON.parse(c); var userConfig = JSON.parse(c); - if (typeof(userConfig) !== 'object' || Array.isArray(userConfig)) { + if (typeof (userConfig) !== 'object' || Array.isArray(userConfig)) { throw new errors.ConfigError( format('"%s" is not an object', opts.configPath)); } diff --git a/lib/do_packages.js b/lib/do_packages.js index c312a5e..9b769c0 100644 --- a/lib/do_packages.js +++ b/lib/do_packages.js @@ -56,7 +56,7 @@ function do_packages (subcmd, opts, args, callback) { * on a possible "foo-" prefix. */ pkg._groupPlus = (pkg.group || (pkg.name.indexOf('-') === -1 - ? "" : pkg.name.split('-', 1)[0])); + ? '' : pkg.name.split('-', 1)[0])); if (!opts.p) { pkg.memoryHuman = common.humanSizeFromBytes({ diff --git a/lib/do_wait_instance.js b/lib/do_wait_instance.js index d48e20b..748a9d1 100644 --- a/lib/do_wait_instance.js +++ b/lib/do_wait_instance.js @@ -57,11 +57,11 @@ function do_wait_instance(subcmd, opts, args, cb) { if (idsToWaitFor.length === 1) { var inst2 = instFromId[idsToWaitFor[0]]; console.log( - "Waiting for instance %s (%s) to enter state (states: %s)", + 'Waiting for instance %s (%s) to enter state (states: %s)', inst2.name, inst2.id, states.join(', ')); } else { console.log( - "Waiting for %d instances to enter state (states: %s)", + 'Waiting for %d instances to enter state (states: %s)', idsToWaitFor.length, states.join(', ')); } diff --git a/lib/triton.js b/lib/triton.js index 88ee33c..6cf3dee 100644 --- a/lib/triton.js +++ b/lib/triton.js @@ -142,7 +142,8 @@ Triton.prototype.listImages = function listImages(opts, cb) { if (opts.useCache) { fs.readFile(cacheFile, 'utf8', function (err, out) { if (err) { - self.log.info({err: err}, 'failed to read cache file %s', cacheFile); + self.log.info({err: err}, 'failed to read cache file %s', + cacheFile); fetch(); return; }