You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by gl...@apache.org on 2020/02/12 11:26:03 UTC

[couchdb-nano] 15/15: standard styling of examples

This is an automated email from the ASF dual-hosted git repository.

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

commit 4d1122af8b24fa2bfa96dcb6a5647cd6f51c032e
Author: Glynn Bird <gl...@gmail.com>
AuthorDate: Wed Feb 12 11:18:54 2020 +0000

    standard styling of examples
---
 examples/lazy_creation_of_views.js           | 6 ++++--
 examples/lazy_db_creation_and_replication.js | 7 ++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/examples/lazy_creation_of_views.js b/examples/lazy_creation_of_views.js
index 7e7fbe6..7bb08c0 100644
--- a/examples/lazy_creation_of_views.js
+++ b/examples/lazy_creation_of_views.js
@@ -13,8 +13,10 @@
 module.exports = function () {
   const nano = require('nano')('http://localhost:5984')
   const users = nano.use('users')
-  const VIEWS = { by_twitter_id:
-    { 'map': 'function(doc) { emit(doc.twitter.screen_name, doc); }' } }
+  const VIEWS = {
+    by_twitter_id:
+    { map: 'function(doc) { emit(doc.twitter.screen_name, doc); }' }
+  }
 
   /*****************************************************************************
  * user.get()
diff --git a/examples/lazy_db_creation_and_replication.js b/examples/lazy_db_creation_and_replication.js
index 7b7d5c2..46df559 100644
--- a/examples/lazy_db_creation_and_replication.js
+++ b/examples/lazy_db_creation_and_replication.js
@@ -12,8 +12,9 @@
 
 const nano = require('nano')
 const couch =
-    { 'master': 'http://localhost:5984/landing_m',
-      'replica': 'http://localhost:5984/landing_r'
+    {
+      master: 'http://localhost:5984/landing_m',
+      replica: 'http://localhost:5984/landing_r'
     }
 
 function insertWithRetry (db, email, retries, callback) {
@@ -47,7 +48,7 @@ function replicateWithRetry (masterUri, replicaUri, retries, callback) {
   retries = retries || 0
   var master = nano(couch.master)
   master.replicate(couch.replica, function (err, resp, head) {
-    if (err && err['error'] === 'db_not_found' && retries < 1) {
+    if (err && err.error === 'db_not_found' && retries < 1) {
       const replica = nano(couch.replica)
       const dbName = replica.config.db
       const server = nano(replica.config.url)