couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From glynnb...@apache.org
Subject [couchdb-nano] branch issue85 updated: save line of code and qs->qs1
Date Mon, 02 Jul 2018 13:58:41 GMT
This is an automated email from the ASF dual-hosted git repository.

glynnbird pushed a commit to branch issue85
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git


The following commit(s) were added to refs/heads/issue85 by this push:
     new 5adc7b6  save line of code and qs->qs1
5adc7b6 is described below

commit 5adc7b676a8f3266b12ceab0ba20c5b521fd2fc3
Author: Glynn Bird <glynn.bird@gmail.com>
AuthorDate: Mon Jul 2 14:58:20 2018 +0100

    save line of code and qs->qs1
---
 lib/nano.js | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/lib/nano.js b/lib/nano.js
index 3a0aef3..bab735d 100644
--- a/lib/nano.js
+++ b/lib/nano.js
@@ -551,10 +551,9 @@ module.exports = exports = nano = function dbScope(cfg) {
         callback = qs;
         qs = {};
       }
-      qs = qs || {};
 
       // prevent mutation of the client qs object by using a clone
-      qs = Object.assign({}, qs)
+      var qs1 = Object.assign({}, qs)
 
       var viewPath = '_design/' + ddoc + '/_' + meta.type + '/'  + viewName;
 
@@ -562,28 +561,28 @@ module.exports = exports = nano = function dbScope(cfg) {
       // object API, several parameters need JSON endoding.
       var paramsToEncode = ['counts', 'drilldown', 'group_sort', 'ranges', 'sort'];
       paramsToEncode.forEach(function(param) {
-        if (param in qs) {
-          if (typeof qs[param] !== 'string') {
-            qs[param] = JSON.stringify(qs[param]);
+        if (param in qs1) {
+          if (typeof qs1[param] !== 'string') {
+            qs1[param] = JSON.stringify(qs1[param]);
           } else {
             // if the parameter is not already encoded, encode it
             try {
-              JSON.parse(qs[param]);
+              JSON.parse(qs1[param]);
             } catch(e) {
-              qs[param] = JSON.stringify(qs[param]);
+              qs1[param] = JSON.stringify(qs1[param]);
             }
           }
         }
       });
 
-      if (qs && qs.keys) {
-        var body = {keys: qs.keys};
-        delete qs.keys;
+      if (qs1 && qs1.keys) {
+        var body = {keys: qs1.keys};
+        delete qs1.keys;
         return relax({
           db: dbName,
           path: viewPath,
           method: 'POST',
-          qs: qs,
+          qs: qs1,
           body: body
         }, callback);
       } else {
@@ -591,7 +590,7 @@ module.exports = exports = nano = function dbScope(cfg) {
           db: dbName,
           method: meta.method || 'GET',
           path: viewPath,
-          qs: qs
+          qs: qs1
         };
 
         if (meta.body) {


Mime
View raw message