You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by ro...@apache.org on 2015/07/12 13:55:44 UTC

[24/50] couchdb-nano git commit: codestyle fixes with `else` in a newline

codestyle fixes with `else` in a newline


Project: http://git-wip-us.apache.org/repos/asf/couchdb-nano/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-nano/commit/5bfaee8a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-nano/tree/5bfaee8a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-nano/diff/5bfaee8a

Branch: refs/heads/master
Commit: 5bfaee8a9a03745fa41ed0567ddee8e1c5b18424
Parents: 61a3c37
Author: Johannes J. Schmidt <jo...@die-tf.de>
Authored: Fri Feb 27 22:36:53 2015 +0100
Committer: Johannes J. Schmidt <jo...@die-tf.de>
Committed: Fri Feb 27 22:36:53 2015 +0100

----------------------------------------------------------------------
 lib/nano.js                         | 13 +++++--------
 tests/integration/shared/updates.js | 15 +++++++--------
 2 files changed, 12 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-nano/blob/5bfaee8a/lib/nano.js
----------------------------------------------------------------------
diff --git a/lib/nano.js b/lib/nano.js
index 6aeadd2..e957594 100644
--- a/lib/nano.js
+++ b/lib/nano.js
@@ -100,14 +100,12 @@ module.exports = exports = nano = function dbScope(cfg) {
 
     if (opts.path) {
       req.uri += '/' + opts.path;
-    }
-    else if (opts.doc) {
-      // http://wiki.apache.org/couchdb/HTTP_Document_API#Naming.2FAddressing
+    } else if (opts.doc) {
       if (!/^_design/.test(opts.doc)) {
+        // http://wiki.apache.org/couchdb/HTTP_Document_API#Naming.2FAddressing
         req.uri += '/' + encodeURIComponent(opts.doc);
-      }
-      // http://wiki.apache.org/couchdb/HTTP_Document_API#Document_IDs
-      else {
+      } else {
+        // http://wiki.apache.org/couchdb/HTTP_Document_API#Document_IDs
         req.uri += '/' + opts.doc;
       }
 
@@ -148,8 +146,7 @@ module.exports = exports = nano = function dbScope(cfg) {
     if (opts.body) {
       if (Buffer.isBuffer(opts.body) || opts.dontStringify) {
         req.body = opts.body;
-      }
-      else {
+      } else {
         req.body = JSON.stringify(opts.body, function(key, value) {
           // don't encode functions
           if (typeof(value) === 'function') {

http://git-wip-us.apache.org/repos/asf/couchdb-nano/blob/5bfaee8a/tests/integration/shared/updates.js
----------------------------------------------------------------------
diff --git a/tests/integration/shared/updates.js b/tests/integration/shared/updates.js
index 8bbff78..54710e1 100644
--- a/tests/integration/shared/updates.js
+++ b/tests/integration/shared/updates.js
@@ -15,18 +15,17 @@ it('should be able to track updates in couch', function(assert) {
       }
       called = true;
 
-      //
-      // older couches
-      //
       if (err && updates.error && updates.error === 'illegal_database_name') {
+        //
+        // older couches
+        //
         assert.expect(1);
         assert.ok(updates.ok, 'db updates are not supported');
         assert.end();
-      }
-      //
-      // new couches
-      //
-      else {
+      } else {
+        //
+        // new couches
+        //
         assert.equal(err, null, 'got root');
         assert.ok(updates.ok, 'updates are ok');
         assert.equal(updates.type, 'created', 'update was a create');