Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.
/ leveldown Public archive

Commit 39e3ca3

Browse files
committed
Bump standard from 15.x to 16.x
1 parent 6c2ecd7 commit 39e3ca3

18 files changed

+63
-61
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ updates:
88
- dependency-name: dependency-check
99
- dependency-name: cross-env
1010
- dependency-name: node-gyp
11-
- dependency-name: standard
1211
- dependency-name: tempy

chained-batch.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
const util = require('util')
24
const AbstractChainedBatch = require('abstract-leveldown').AbstractChainedBatch
35
const binding = require('./binding')

iterator.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
const util = require('util')
24
const AbstractIterator = require('abstract-leveldown').AbstractIterator
35
const binding = require('./binding')
@@ -23,19 +25,17 @@ Iterator.prototype._seek = function (target) {
2325
}
2426

2527
Iterator.prototype._next = function (callback) {
26-
var that = this
27-
2828
if (this.cache && this.cache.length) {
2929
process.nextTick(callback, null, this.cache.pop(), this.cache.pop())
3030
} else if (this.finished) {
3131
process.nextTick(callback)
3232
} else {
33-
binding.iterator_next(this.context, function (err, array, finished) {
33+
binding.iterator_next(this.context, (err, array, finished) => {
3434
if (err) return callback(err)
3535

36-
that.cache = array
37-
that.finished = finished
38-
that._next(callback)
36+
this.cache = array
37+
this.finished = finished
38+
this._next(callback)
3939
})
4040
}
4141

leveldown.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
const util = require('util')
24
const AbstractLevelDOWN = require('abstract-leveldown').AbstractLevelDOWN
35
const binding = require('./binding')

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"prebuildify-cross": "^4.0.0",
5050
"readfiletree": "^1.0.0",
5151
"rimraf": "^3.0.0",
52-
"standard": "^15.0.0",
52+
"standard": "^16.0.3",
5353
"tape": "^5.0.1",
5454
"tempy": "^0.3.0"
5555
},

test/approximate-size-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const test = require('tape')
22
const testCommon = require('./common')
33

4-
var db
4+
let db
55

66
test('setUp common for approximate size', testCommon.setUp)
77

@@ -66,7 +66,7 @@ test('test 1-arg + callback approximateSize() throws', function (t) {
6666

6767
test('test custom _serialize*', function (t) {
6868
t.plan(4)
69-
var db = testCommon.factory()
69+
const db = testCommon.factory()
7070
db._serializeKey = function (data) { return data }
7171
db.approximateSize = function (start, end, callback) {
7272
t.deepEqual(start, { foo: 'bar' })
@@ -82,7 +82,7 @@ test('test custom _serialize*', function (t) {
8282
})
8383

8484
test('test approximateSize()', function (t) {
85-
var data = Array.apply(null, Array(10000)).map(function () {
85+
const data = Array.apply(null, Array(10000)).map(function () {
8686
return 'aaaaaaaaaa'
8787
}).join('')
8888

test/cleanup-hanging-iterators-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const repeats = 200
33

44
makeTest('test ended iterator', function (db, t, done) {
55
// First test normal and proper usage: calling it.end() before db.close()
6-
var it = db.iterator({ keyAsBuffer: false, valueAsBuffer: false })
6+
const it = db.iterator({ keyAsBuffer: false, valueAsBuffer: false })
77

88
it.next(function (err, key, value) {
99
t.ifError(err, 'no error from next()')
@@ -19,7 +19,7 @@ makeTest('test ended iterator', function (db, t, done) {
1919
makeTest('test likely-ended iterator', function (db, t, done) {
2020
// Test improper usage: not calling it.end() before db.close(). Cleanup of the
2121
// database will crash Node if not handled properly.
22-
var it = db.iterator({ keyAsBuffer: false, valueAsBuffer: false })
22+
const it = db.iterator({ keyAsBuffer: false, valueAsBuffer: false })
2323

2424
it.next(function (err, key, value) {
2525
t.ifError(err, 'no error from next()')
@@ -33,7 +33,7 @@ makeTest('test non-ended iterator', function (db, t, done) {
3333
// Same as the test above but with a highWaterMark of 0 so that we don't
3434
// preemptively fetch all records, to ensure that the iterator is still
3535
// active when we (attempt to) close the database.
36-
var it = db.iterator({
36+
const it = db.iterator({
3737
highWaterMark: 0,
3838
keyAsBuffer: false,
3939
valueAsBuffer: false
@@ -84,10 +84,10 @@ global.gc && makeTest('test multiple non-ended iterators with forced gc', functi
8484

8585
makeTest('test ending iterators', function (db, t, done) {
8686
// At least one end() should be in progress when we try to close the db.
87-
var it1 = db.iterator().next(function () {
87+
const it1 = db.iterator().next(function () {
8888
it1.end(function () {})
8989
})
90-
var it2 = db.iterator().next(function () {
90+
const it2 = db.iterator().next(function () {
9191
it2.end(function () {})
9292
done()
9393
})

test/compact-range-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ test('setUp db', function (t) {
1111
})
1212

1313
test('test compactRange() frees disk space after key deletion', function (t) {
14-
var key1 = '000000'
15-
var key2 = '000001'
16-
var val1 = Buffer.allocUnsafe(64).fill(1)
17-
var val2 = Buffer.allocUnsafe(64).fill(1)
14+
const key1 = '000000'
15+
const key2 = '000001'
16+
const val1 = Buffer.allocUnsafe(64).fill(1)
17+
const val2 = Buffer.allocUnsafe(64).fill(1)
1818

1919
db.batch().put(key1, val1).put(key2, val2).write(function (err) {
2020
t.ifError(err, 'no batch put error')
@@ -46,8 +46,8 @@ test('test compactRange() frees disk space after key deletion', function (t) {
4646
test('test compactRange() serializes start and end', function (t) {
4747
t.plan(3)
4848

49-
var clone = Object.create(db)
50-
var count = 0
49+
const clone = Object.create(db)
50+
let count = 0
5151

5252
clone._serializeKey = function (key) {
5353
t.is(key, count++)

test/compression-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const verify = function (location, compression, t) {
2626

2727
// close, open, close again.. 'compaction' is also performed on open()s
2828
const cycle = function (db, compression, t, callback) {
29-
var location = db.location
29+
const location = db.location
3030
db.close(function (err) {
3131
t.error(err)
3232
db = leveldown(location)
@@ -45,7 +45,7 @@ test('compression', function (t) {
4545
t.test('set up', testCommon.setUp)
4646

4747
t.test('test data is compressed by default (db.put())', function (t) {
48-
var db = testCommon.factory()
48+
const db = testCommon.factory()
4949
db.open(function (err) {
5050
t.error(err)
5151
each(
@@ -59,7 +59,7 @@ test('compression', function (t) {
5959
})
6060

6161
t.test('test data is not compressed with compression=false on open() (db.put())', function (t) {
62-
var db = testCommon.factory()
62+
const db = testCommon.factory()
6363
db.open({ compression: false }, function (err) {
6464
t.error(err)
6565
each(
@@ -73,7 +73,7 @@ test('compression', function (t) {
7373
})
7474

7575
t.test('test data is compressed by default (db.batch())', function (t) {
76-
var db = testCommon.factory()
76+
const db = testCommon.factory()
7777
db.open(function (err) {
7878
t.error(err)
7979
db.batch(

test/destroy-test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ test('test callback-less, 1-arg, destroy() throws', function (t) {
2727
test('test destroy non-existent directory', function (t) {
2828
t.plan(4)
2929

30-
var location = tempy.directory()
31-
var parent = path.dirname(location)
30+
const location = tempy.directory()
31+
const parent = path.dirname(location)
3232

3333
// For symmetry with the opposite test below.
3434
t.ok(fs.existsSync(parent), 'parent exists before')
@@ -50,8 +50,8 @@ test('test destroy non-existent directory', function (t) {
5050
test('test destroy non-existent parent directory', function (t) {
5151
t.plan(3)
5252

53-
var location = '/1/2/3/4'
54-
var parent = path.dirname(location)
53+
const location = '/1/2/3/4'
54+
const parent = path.dirname(location)
5555

5656
t.notOk(fs.existsSync(parent), 'parent does not exist before')
5757

@@ -62,7 +62,7 @@ test('test destroy non-existent parent directory', function (t) {
6262
})
6363

6464
test('test destroy non leveldb directory', function (t) {
65-
var tree = {
65+
const tree = {
6666
foo: 'FOO',
6767
bar: { one: 'ONE', two: 'TWO', three: 'THREE' }
6868
}
@@ -87,7 +87,7 @@ test('test destroy non leveldb directory', function (t) {
8787
})
8888

8989
makeTest('test destroy() cleans and removes leveldb-only dir', function (db, t, done) {
90-
var location = db.location
90+
const location = db.location
9191
db.close(function (err) {
9292
t.ifError(err, 'no error from close()')
9393

@@ -101,7 +101,7 @@ makeTest('test destroy() cleans and removes leveldb-only dir', function (db, t,
101101
})
102102

103103
makeTest('test destroy() cleans and removes only leveldb parts of a dir', function (db, t, done) {
104-
var location = db.location
104+
const location = db.location
105105
fs.writeFileSync(path.join(location, 'foo'), 'FOO')
106106

107107
db.close(function (err) {

0 commit comments

Comments
 (0)