Skip to content

Commit dea0502

Browse files
authored
Merge pull request #116 from jo/feat/update-dependencies
feat: update dependencies
2 parents 5509137 + 9c85e07 commit dea0502

File tree

6 files changed

+24556
-32747
lines changed

6 files changed

+24556
-32747
lines changed

cli.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#!/usr/bin/env node
22

3-
var minimist = require('minimist')
4-
var push = require('./')
3+
const minimist = require('minimist')
4+
const push = require('./')
55

6-
var options = minimist(process.argv.slice(2), {
6+
const options = minimist(process.argv.slice(2), {
77
boolean: ['index', 'multipart', 'watch']
88
})
99
if (!options._.length) {
1010
console.log('Usage: \ncouchdb-push URL [SOURCE] [OPTIONS]')
1111
process.exit()
1212
}
1313

14-
var db = options._[0]
15-
var source = options._[1] || process.cwd()
14+
const db = options._[0]
15+
const source = options._[1] || process.cwd()
1616

1717
push(db, source, options, function (error, response) {
1818
if (error) return console.error(error)

index.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// couchdb-push
22
// (c) 2014 Johannes J. Schmidt
33

4-
var crypto = require('crypto')
5-
var async = require('async')
6-
var omit = require('lodash/omit')
7-
var isEqual = require('lodash/isEqual')
8-
var nanoOption = require('nano-option')
9-
var compile = require('couchdb-compile')
10-
var ensure = require('couchdb-ensure')
11-
var chokidar = require('chokidar')
4+
const crypto = require('crypto')
5+
const async = require('async')
6+
const omit = require('lodash/omit')
7+
const isEqual = require('lodash/isEqual')
8+
const nanoOption = require('nano-option')
9+
const compile = require('couchdb-compile')
10+
const ensure = require('couchdb-ensure')
11+
const chokidar = require('chokidar')
1212

1313
module.exports = function push (db, source, options, callback) {
1414
if (typeof options === 'function') {
@@ -40,10 +40,10 @@ module.exports = function push (db, source, options, callback) {
4040
return false
4141
}
4242

43-
var md5sum = crypto.createHash('md5')
44-
var data = options.multipart ? attachment.data : Buffer.from(attachment.data, 'base64')
43+
const md5sum = crypto.createHash('md5')
44+
const data = options.multipart ? attachment.data : Buffer.from(attachment.data, 'base64')
4545
md5sum.update(data)
46-
var digest = 'md5-' + md5sum.digest('base64')
46+
const digest = 'md5-' + md5sum.digest('base64')
4747

4848
return existingAttachment.digest === digest
4949
}
@@ -53,9 +53,9 @@ module.exports = function push (db, source, options, callback) {
5353

5454
if (options.multipart) {
5555
if (attachments.length) {
56-
for (var i = 0; i < attachments.length; i++) {
57-
var name = attachments[i].name
58-
var identical = diffAttachment(attachments[i], existingDoc && existingDoc._attachments && existingDoc._attachments[name])
56+
for (let i = 0; i < attachments.length; i++) {
57+
const name = attachments[i].name
58+
const identical = diffAttachment(attachments[i], existingDoc && existingDoc._attachments && existingDoc._attachments[name])
5959

6060
if (identical) {
6161
doc._attachments = doc._attachments || {}
@@ -67,7 +67,7 @@ module.exports = function push (db, source, options, callback) {
6767
} else {
6868
if (doc._attachments) {
6969
Object.keys(doc._attachments).forEach(function (name) {
70-
var identical = diffAttachment(doc._attachments[name], existingDoc && existingDoc._attachments && existingDoc._attachments[name])
70+
const identical = diffAttachment(doc._attachments[name], existingDoc && existingDoc._attachments && existingDoc._attachments[name])
7171

7272
if (identical) {
7373
doc._attachments[name] = existingDoc._attachments[name]
@@ -103,8 +103,8 @@ module.exports = function push (db, source, options, callback) {
103103
return callback(error)
104104
}
105105

106-
var userDocToCompare = omit(doc, 'password')
107-
var existingDocToCompare = omit(existingDoc, 'derived_key', 'iterations', 'password_scheme', 'salt')
106+
const userDocToCompare = omit(doc, 'password')
107+
const existingDocToCompare = omit(existingDoc, 'derived_key', 'iterations', 'password_scheme', 'salt')
108108

109109
callback(null, !isEqual(userDocToCompare, existingDocToCompare))
110110
})
@@ -156,9 +156,10 @@ module.exports = function push (db, source, options, callback) {
156156
}
157157

158158
if (options.watch) {
159-
var queue = async.queue(function (task, done) {
159+
const queue = async.queue(function (task, done) {
160160
compileDoc(function (error, response) {
161-
error ? console.error(error)
161+
error
162+
? console.error(error)
162163
: console.log(JSON.stringify(response, null, ' '))
163164
done(error)
164165
})

0 commit comments

Comments
 (0)