couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [couchdb-nano] 02/02: remove underscore and use lodash.isEmptry instead
Date Tue, 27 Feb 2018 13:18:23 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit dfc3a259c646c767b84301b179cebe78b98b1d88
Author: Garren Smith <garren.smith@gmail.com>
AuthorDate: Tue Feb 27 15:18:07 2018 +0200

    remove underscore and use lodash.isEmptry instead
---
 lib/nano.js  | 14 +++++++-------
 package.json |  6 +++---
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/nano.js b/lib/nano.js
index 69fed84..02c04e1 100644
--- a/lib/nano.js
+++ b/lib/nano.js
@@ -17,7 +17,7 @@ var assert = require('assert');
 var querystring = require('querystring');
 var request = require('request');
 var errs = require('errs');
-var _ = require('underscore');
+var isEmpty = require('lodash.isempty');
 var follow = require('cloudant-follow');
 var logger = require('./logger');
 
@@ -35,7 +35,7 @@ module.exports = exports = nano = function dbScope(cfg) {
     'You must specify the endpoint url when invoking this module');
   assert.ok(/^https?:/.test(cfg.url), 'url is not valid');
 
-  cfg = _.clone(cfg);
+  cfg = Object.assign({}, cfg);
 
   serverScope.config = cfg;
   cfg.requestDefaults = cfg.requestDefaults || {jar: false};
@@ -84,7 +84,7 @@ module.exports = exports = nano = function dbScope(cfg) {
       callback = null;
     }
 
-    var qs = _.extend({}, opts.qs);
+    var qs = Object.assign({}, opts.qs);
 
     var headers = {
       'content-type': 'application/json',
@@ -116,7 +116,7 @@ module.exports = exports = nano = function dbScope(cfg) {
       req.multipart = opts.multipart;
     }
 
-    req.headers = _.extend(req.headers, opts.headers, cfg.defaultHeaders);
+    req.headers = Object.assign(req.headers, opts.headers, cfg.defaultHeaders);
 
     if (opts.path) {
       req.uri += '/' + opts.path;
@@ -154,7 +154,7 @@ module.exports = exports = nano = function dbScope(cfg) {
     }
 
     // http://wiki.apache.org/couchdb/HTTP_view_API#Querying_Options
-    if (typeof opts.qs === 'object' && !_.isEmpty(opts.qs)) {
+    if (typeof opts.qs === 'object' && !isEmpty(opts.qs)) {
       ['startkey', 'endkey', 'key', 'keys'].forEach(function(key) {
         if (key in opts.qs) {
           qs[key] = JSON.stringify(opts.qs[key]);
@@ -660,7 +660,7 @@ module.exports = exports = nano = function dbScope(cfg) {
       var docName = qs.docName;
       delete qs.docName;
 
-      doc = _.extend({_attachments: {}}, doc);
+      doc = Object.assign({_attachments: {}}, doc);
 
       var multipart = [];
 
@@ -839,7 +839,7 @@ module.exports = exports = nano = function dbScope(cfg) {
   }
 
   // server level exports
-  serverScope = _.extend(serverScope, {
+  serverScope = Object.assign(serverScope, {
     db: {
       create: createDb,
       get: getDb,
diff --git a/package.json b/package.json
index 0f40ef9..b09b6cc 100644
--- a/package.json
+++ b/package.json
@@ -17,11 +17,11 @@
     "database"
   ],
   "dependencies": {
-    "request": "~2.83.0",
     "cloudant-follow": "~0.16.1",
+    "debug": "^2.2.0",
     "errs": "^0.3.2",
-    "underscore": "^1.8.3",
-    "debug": "^2.2.0"
+    "lodash.isempty": "^4.4.0",
+    "request": "~2.83.0"
   },
   "devDependencies": {
     "async": "^2.1.2",

-- 
To stop receiving notification emails like this one, please contact
garren@apache.org.

Mime
View raw message