Skip to content

Commit

Permalink
after standard --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars-Magnus Skog committed Jun 2, 2017
1 parent 665c0b4 commit 5e98fff
Show file tree
Hide file tree
Showing 52 changed files with 2,527 additions and 2,601 deletions.
8 changes: 4 additions & 4 deletions buster.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var config = module.exports

config['unit'] = {
environment: 'node'
, tests: [ 'test/*-test.js' ]
, libs: [ 'test/common.js' ]
}
environment: 'node',
tests: [ 'test/*-test.js' ],
libs: [ 'test/common.js' ]
}
26 changes: 12 additions & 14 deletions lib/batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* <https://github.com/level/levelup/blob/master/LICENSE.md>
*/

var util = require('./util')
, WriteError = require('level-errors').WriteError
var util = require('./util'),
WriteError = require('level-errors').WriteError,

, getOptions = util.getOptions
, dispatchError = util.dispatchError
getOptions = util.getOptions,
dispatchError = util.dispatchError

function Batch (levelup, codec) {
this._levelup = levelup
Expand All @@ -21,15 +21,15 @@ function Batch (levelup, codec) {
Batch.prototype.put = function (key_, value_, options) {
options = getOptions(options)

var key = this._codec.encodeKey(key_, options)
, value = this._codec.encodeValue(value_, options)
var key = this._codec.encodeKey(key_, options),
value = this._codec.encodeValue(value_, options)

try {
this.batch.put(key, value)
} catch (e) {
throw new WriteError(e)
}
this.ops.push({ type : 'put', key : key, value : value })
this.ops.push({ type: 'put', key: key, value: value })
this.length++

return this
Expand All @@ -45,7 +45,7 @@ Batch.prototype.del = function (key_, options) {
} catch (err) {
throw new WriteError(err)
}
this.ops.push({ type : 'del', key : key })
this.ops.push({ type: 'del', key: key })
this.length++

return this
Expand All @@ -64,16 +64,14 @@ Batch.prototype.clear = function () {
}

Batch.prototype.write = function (callback) {
var levelup = this._levelup
, ops = this.ops
var levelup = this._levelup,
ops = this.ops

try {
this.batch.write(function (err) {
if (err)
return dispatchError(levelup, new WriteError(err), callback)
if (err) { return dispatchError(levelup, new WriteError(err), callback) }
levelup.emit('batch', ops)
if (callback)
callback()
if (callback) { callback() }
})
} catch (err) {
throw new WriteError(err)
Expand Down
23 changes: 11 additions & 12 deletions lib/leveldown.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
var LevelUPError = require('level-errors').LevelUPError
, format = require('util').format
, leveldown
var LevelUPError = require('level-errors').LevelUPError,
format = require('util').format,
leveldown

function getLevelDOWN () {
if (leveldown)
return leveldown
if (leveldown) { return leveldown }

var requiredVersion = require('../package.json').devDependencies.leveldown
, leveldownVersion
var requiredVersion = require('../package.json').devDependencies.leveldown,
leveldownVersion

try {
leveldownVersion = require('leveldown/package.json').version
Expand All @@ -17,11 +16,11 @@ function getLevelDOWN () {

if (!require('semver').satisfies(leveldownVersion, requiredVersion)) {
throw new LevelUPError(
'Installed version of LevelDOWN ('
+ leveldownVersion
+ ') does not match required version ('
+ requiredVersion
+ ')'
'Installed version of LevelDOWN (' +
leveldownVersion +
') does not match required version (' +
requiredVersion +
')'
)
}

Expand Down
Loading

0 comments on commit 5e98fff

Please sign in to comment.