Skip to content

Commit 995db5d

Browse files
committed
fix: var to const
1 parent 95cd4be commit 995db5d

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

index.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// dependencies
2-
var os = require('os')
3-
var through = require('through2')
4-
var log = require('fancy-log')
5-
var PluginError = require('plugin-error')
6-
var assign = require('lodash.assign')
7-
var File = require('vinyl')
8-
var Path = require('path')
9-
var exist = require('@existdb/node-exist')
10-
11-
var defaultRPCoptions = {
2+
const os = require('os')
3+
const through = require('through2')
4+
const log = require('fancy-log')
5+
const PluginError = require('plugin-error')
6+
const assign = require('lodash.assign')
7+
const File = require('vinyl')
8+
const Path = require('path')
9+
const exist = require('@existdb/node-exist')
10+
11+
const defaultRPCoptions = {
1212
host: 'localhost',
1313
port: '8080',
1414
path: '/exist/xmlrpc',
@@ -18,18 +18,18 @@ var defaultRPCoptions = {
1818
}
1919
}
2020

21-
var defaultUploadOptions = {
21+
const defaultUploadOptions = {
2222
html5AsBinary: false,
2323
target: '',
2424
permissions: null
2525
}
2626

27-
var defaultQueryOptions = {
27+
const defaultQueryOptions = {
2828
printXqlResults: true,
2929
xqlOutputExt: 'xml'
3030
}
3131

32-
var isWin = os.platform() === 'win32'
32+
const isWin = os.platform() === 'win32'
3333

3434
function isSaxParserError (error) {
3535
return error && error.faultString && /SAXParseException/.test(error.faultString)
@@ -40,14 +40,14 @@ function normalizePath (path) {
4040
}
4141

4242
function createCollection (client, collection) {
43-
var normalizedCollectionPath = normalizePath(collection)
43+
const normalizedCollectionPath = normalizePath(collection)
4444
log('Creating collection "' + normalizedCollectionPath + '"...')
4545
return client.collections.create(normalizedCollectionPath)
4646
}
4747

4848
module.exports.createClient = function createClient (options) {
4949
// TODO sanity checks
50-
var client = exist.connect(assign({}, defaultRPCoptions, options))
50+
const client = exist.connect(assign({}, defaultRPCoptions, options))
5151
return {
5252
dest: sendFilesWith(client),
5353
query: queryWith(client),
@@ -65,9 +65,9 @@ module.exports.getMimeType = function (path) {
6565

6666
function sendFilesWith (client) {
6767
return function send (options) {
68-
var conf = assign({}, defaultUploadOptions, options)
68+
const conf = assign({}, defaultUploadOptions, options)
6969

70-
var storeFile = function (vf, enc, callback) {
70+
const storeFile = function (vf, enc, callback) {
7171
if (vf.isStream()) {
7272
return this.emit('error', new PluginError('gulp-exist', 'Streaming not supported'))
7373
}
@@ -84,16 +84,16 @@ function sendFilesWith (client) {
8484
}
8585

8686
// rewrap to newer version of vinyl file object
87-
var file = new File({
87+
const file = new File({
8888
base: vf.base,
8989
path: vf.path,
9090
contents: vf.contents
9191
})
9292

93-
var remotePath = normalizePath(conf.target + '/' + file.relative)
93+
const remotePath = normalizePath(conf.target + '/' + file.relative)
9494

95-
var folder = file.relative.substring(0, file.relative.length - file.basename.length)
96-
var collection = Path.normalize(conf.target) + '/' + folder
95+
const folder = file.relative.substring(0, file.relative.length - file.basename.length)
96+
const collection = Path.normalize(conf.target) + '/' + folder
9797

9898
// create target collection if neccessary
9999
return client.collections.describe(collection)
@@ -150,7 +150,7 @@ function sendFilesWith (client) {
150150

151151
function queryWith (client) {
152152
return function query (options) {
153-
var conf = assign({}, defaultQueryOptions, options)
153+
const conf = assign({}, defaultQueryOptions, options)
154154

155155
function executeQuery (file, enc, callback) {
156156
if (file.isStream()) {
@@ -166,7 +166,7 @@ function queryWith (client) {
166166

167167
client.queries.readAll(file.contents, {})
168168
.then(function (result) {
169-
var resultBuffer = Buffer.concat(result.pages)
169+
const resultBuffer = Buffer.concat(result.pages)
170170
if (conf.printXqlResults) {
171171
log(resultBuffer.toString())
172172
}
@@ -187,11 +187,11 @@ function queryWith (client) {
187187

188188
function checkForNewerWith (client) {
189189
return function newer (options) {
190-
var conf = assign({}, defaultUploadOptions, options)
190+
const conf = assign({}, defaultUploadOptions, options)
191191

192192
function checkFile (file, enc, callback) {
193193
if (file.isDirectory()) {
194-
var collection = normalizePath(conf.target + '/' + file.relative)
194+
const collection = normalizePath(conf.target + '/' + file.relative)
195195
client.collections.describe(collection)
196196
.then(function () {
197197
callback(null)
@@ -204,7 +204,7 @@ function checkForNewerWith (client) {
204204

205205
client.resources.describe(normalizePath(conf.target + '/' + file.relative))
206206
.then(function (resourceInfo) {
207-
var newer = !resourceInfo.hasOwnProperty('modified') || (Date.parse(file.stat.mtime) > Date.parse(resourceInfo.modified))
207+
const newer = !resourceInfo.hasOwnProperty('modified') || (Date.parse(file.stat.mtime) > Date.parse(resourceInfo.modified))
208208
callback(null, newer ? file : null)
209209
})
210210
.catch(function (e) {

0 commit comments

Comments
 (0)