encoding-down
Advanced tools
Comparing version 6.1.0 to 6.2.0
110
CHANGELOG.md
# Changelog | ||
## [Unreleased][unreleased] | ||
## [6.2.0] - 2019-09-06 | ||
### Changed | ||
- Upgrade `hallmark` devDependency from `^0.1.0` to `^2.0.0` ([#85](https://github.com/Level/encoding-down/issues/85), [#91](https://github.com/Level/encoding-down/issues/91)) ([**@vweevers**](https://github.com/vweevers)) | ||
- Upgrade `standard` devDependency from `^12.0.0` to `^14.0.0` ([#84](https://github.com/Level/encoding-down/issues/84), [#90](https://github.com/Level/encoding-down/issues/90)) ([**@vweevers**](https://github.com/vweevers)) | ||
- Upgrade `memdown` devDependency from `^4.0.0` to `^5.0.0` ([#88](https://github.com/Level/encoding-down/issues/88)) ([**@vweevers**](https://github.com/vweevers)) | ||
### Added | ||
- Support `db.clear()` ([#89](https://github.com/Level/encoding-down/issues/89)) ([**@vweevers**](https://github.com/vweevers)) | ||
## [6.1.0] - 2019-06-22 | ||
@@ -27,11 +37,11 @@ | ||
- Replace `remark-cli` devDependency with `hallmark` ([#76](https://github.com/level/encoding-down/issues/76)) ([**@vweevers**](https://github.com/vweevers)) | ||
- Replace `remark-cli` devDependency with `hallmark` ([#76](https://github.com/Level/encoding-down/issues/76)) ([**@vweevers**](https://github.com/vweevers)) | ||
### Added | ||
- Increase coverage to 100% ([#75](https://github.com/level/encoding-down/issues/75)) ([**@vweevers**](https://github.com/vweevers)) | ||
- Increase coverage to 100% ([#75](https://github.com/Level/encoding-down/issues/75)) ([**@vweevers**](https://github.com/vweevers)) | ||
### Fixed | ||
- Fix `approximateSize()` to encode `start` and `end` arguments ([#75](https://github.com/level/encoding-down/issues/75)) ([**@vweevers**](https://github.com/vweevers)) | ||
- Fix `approximateSize()` to encode `start` and `end` arguments ([#75](https://github.com/Level/encoding-down/issues/75)) ([**@vweevers**](https://github.com/vweevers)) | ||
@@ -43,10 +53,10 @@ ## [6.0.0] - 2018-12-25 | ||
- Prefer `const` over `var` in README ([**@ralphtheninja**](https://github.com/ralphtheninja)) | ||
- Upgrade `abstract-leveldown` dependency from `^5.0.0` to `^v6.0.0` ([#68](https://github.com/level/encoding-down/issues/68)) ([**@ralphtheninja**](https://github.com/ralphtheninja)) | ||
- Upgrade `abstract-leveldown` dependency from `^5.0.0` to `^v6.0.0` ([#68](https://github.com/Level/encoding-down/issues/68)) ([**@ralphtheninja**](https://github.com/ralphtheninja)) | ||
- Upgrade `standard` devDependency from `^11.0.0` to `^v12.0.0` ([**@ralphtheninja**](https://github.com/ralphtheninja)) | ||
- Use full link references in README ([#60](https://github.com/level/encoding-down/issues/60)) ([**@vweevers**](https://github.com/vweevers)) | ||
- Use full link references in README ([#60](https://github.com/Level/encoding-down/issues/60)) ([**@vweevers**](https://github.com/vweevers)) | ||
### Added | ||
- Explain serialization ([#72](https://github.com/level/encoding-down/issues/72)) ([**@vweevers**](https://github.com/vweevers)) | ||
- Add `nyc` and `coveralls` ([#64](https://github.com/level/encoding-down/issues/64)) ([**@ralphtheninja**](https://github.com/ralphtheninja)) | ||
- Explain serialization ([#72](https://github.com/Level/encoding-down/issues/72)) ([**@vweevers**](https://github.com/vweevers)) | ||
- Add `nyc` and `coveralls` ([#64](https://github.com/Level/encoding-down/issues/64)) ([**@ralphtheninja**](https://github.com/ralphtheninja)) | ||
@@ -89,8 +99,2 @@ ### Removed | ||
## [4.0.1] - 2018-05-19 | ||
### Changed | ||
- Override `_setupIteratorOptions` to not clobber ranges ([**@ralphtheninja**](https://github.com/ralphtheninja), [**@dominictarr**](https://github.com/dominictarr)) | ||
## [5.0.0] - 2018-05-13 | ||
@@ -111,2 +115,8 @@ | ||
## [4.0.1] - 2018-05-19 | ||
### Changed | ||
- Override `_setupIteratorOptions` to not clobber ranges ([**@ralphtheninja**](https://github.com/ralphtheninja), [**@dominictarr**](https://github.com/dominictarr)) | ||
## [4.0.0] - 2018-02-12 | ||
@@ -309,72 +319,72 @@ | ||
[unreleased]: https://github.com/level/encoding-down/compare/v6.1.0...HEAD | ||
[6.2.0]: https://github.com/Level/encoding-down/compare/v6.1.0...v6.2.0 | ||
[6.1.0]: https://github.com/level/encoding-down/compare/v6.0.2...v6.1.0 | ||
[6.1.0]: https://github.com/Level/encoding-down/compare/v6.0.2...v6.1.0 | ||
[6.0.2]: https://github.com/level/encoding-down/compare/v6.0.1...v6.0.2 | ||
[6.0.2]: https://github.com/Level/encoding-down/compare/v6.0.1...v6.0.2 | ||
[6.0.1]: https://github.com/level/encoding-down/compare/v6.0.0...v6.0.1 | ||
[6.0.1]: https://github.com/Level/encoding-down/compare/v6.0.0...v6.0.1 | ||
[6.0.0]: https://github.com/level/encoding-down/compare/v5.0.4...v6.0.0 | ||
[6.0.0]: https://github.com/Level/encoding-down/compare/v5.0.4...v6.0.0 | ||
[5.0.4]: https://github.com/level/encoding-down/compare/v5.0.3...v5.0.4 | ||
[5.0.4]: https://github.com/Level/encoding-down/compare/v5.0.3...v5.0.4 | ||
[5.0.3]: https://github.com/level/encoding-down/compare/v5.0.2...v5.0.3 | ||
[5.0.3]: https://github.com/Level/encoding-down/compare/v5.0.2...v5.0.3 | ||
[5.0.2]: https://github.com/level/encoding-down/compare/v5.0.1...v5.0.2 | ||
[5.0.2]: https://github.com/Level/encoding-down/compare/v5.0.1...v5.0.2 | ||
[5.0.1]: https://github.com/level/encoding-down/compare/v5.0.0...v5.0.1 | ||
[5.0.1]: https://github.com/Level/encoding-down/compare/v5.0.0...v5.0.1 | ||
[5.0.0]: https://github.com/level/encoding-down/compare/v4.0.0...v5.0.0 | ||
[5.0.0]: https://github.com/Level/encoding-down/compare/v4.0.1...v5.0.0 | ||
[4.0.1]: https://github.com/level/encoding-down/compare/v4.0.0...v4.0.1 | ||
[4.0.1]: https://github.com/Level/encoding-down/compare/v4.0.0...v4.0.1 | ||
[4.0.0]: https://github.com/level/encoding-down/compare/v3.0.1...v4.0.0 | ||
[4.0.0]: https://github.com/Level/encoding-down/compare/v3.0.1...v4.0.0 | ||
[3.0.1]: https://github.com/level/encoding-down/compare/v3.0.0...v3.0.1 | ||
[3.0.1]: https://github.com/Level/encoding-down/compare/v3.0.0...v3.0.1 | ||
[3.0.0]: https://github.com/level/encoding-down/compare/v2.3.4...v3.0.0 | ||
[3.0.0]: https://github.com/Level/encoding-down/compare/v2.3.4...v3.0.0 | ||
[2.3.4]: https://github.com/level/encoding-down/compare/v2.3.3...v2.3.4 | ||
[2.3.4]: https://github.com/Level/encoding-down/compare/v2.3.3...v2.3.4 | ||
[2.3.3]: https://github.com/level/encoding-down/compare/v2.3.2...v2.3.3 | ||
[2.3.3]: https://github.com/Level/encoding-down/compare/v2.3.2...v2.3.3 | ||
[2.3.2]: https://github.com/level/encoding-down/compare/v2.3.1...v2.3.2 | ||
[2.3.2]: https://github.com/Level/encoding-down/compare/v2.3.1...v2.3.2 | ||
[2.3.1]: https://github.com/level/encoding-down/compare/v2.3.0...v2.3.1 | ||
[2.3.1]: https://github.com/Level/encoding-down/compare/v2.3.0...v2.3.1 | ||
[2.3.0]: https://github.com/level/encoding-down/compare/v2.2.1...v2.3.0 | ||
[2.3.0]: https://github.com/Level/encoding-down/compare/v2.2.1...v2.3.0 | ||
[2.2.1]: https://github.com/level/encoding-down/compare/v2.2.0...v2.2.1 | ||
[2.2.1]: https://github.com/Level/encoding-down/compare/v2.2.0...v2.2.1 | ||
[2.2.0]: https://github.com/level/encoding-down/compare/v2.1.5...v2.2.0 | ||
[2.2.0]: https://github.com/Level/encoding-down/compare/v2.1.5...v2.2.0 | ||
[2.1.5]: https://github.com/level/encoding-down/compare/v2.1.4...v2.1.5 | ||
[2.1.5]: https://github.com/Level/encoding-down/compare/v2.1.4...v2.1.5 | ||
[2.1.4]: https://github.com/level/encoding-down/compare/v2.1.3...v2.1.4 | ||
[2.1.4]: https://github.com/Level/encoding-down/compare/v2.1.3...v2.1.4 | ||
[2.1.3]: https://github.com/level/encoding-down/compare/v2.1.2...v2.1.3 | ||
[2.1.3]: https://github.com/Level/encoding-down/compare/v2.1.2...v2.1.3 | ||
[2.1.2]: https://github.com/level/encoding-down/compare/v2.1.1...v2.1.2 | ||
[2.1.2]: https://github.com/Level/encoding-down/compare/v2.1.1...v2.1.2 | ||
[2.1.1]: https://github.com/level/encoding-down/compare/v2.1.0...v2.1.1 | ||
[2.1.1]: https://github.com/Level/encoding-down/compare/v2.1.0...v2.1.1 | ||
[2.1.0]: https://github.com/level/encoding-down/compare/v2.0.8...v2.1.0 | ||
[2.1.0]: https://github.com/Level/encoding-down/compare/v2.0.8...v2.1.0 | ||
[2.0.8]: https://github.com/level/encoding-down/compare/v2.0.7...v2.0.8 | ||
[2.0.8]: https://github.com/Level/encoding-down/compare/v2.0.7...v2.0.8 | ||
[2.0.7]: https://github.com/level/encoding-down/compare/v2.0.6...v2.0.7 | ||
[2.0.7]: https://github.com/Level/encoding-down/compare/v2.0.6...v2.0.7 | ||
[2.0.6]: https://github.com/level/encoding-down/compare/v2.0.5...v2.0.6 | ||
[2.0.6]: https://github.com/Level/encoding-down/compare/v2.0.5...v2.0.6 | ||
[2.0.5]: https://github.com/level/encoding-down/compare/v2.0.4...v2.0.5 | ||
[2.0.5]: https://github.com/Level/encoding-down/compare/v2.0.4...v2.0.5 | ||
[2.0.4]: https://github.com/level/encoding-down/compare/v2.0.3...v2.0.4 | ||
[2.0.4]: https://github.com/Level/encoding-down/compare/v2.0.3...v2.0.4 | ||
[2.0.3]: https://github.com/level/encoding-down/compare/v2.0.2...v2.0.3 | ||
[2.0.3]: https://github.com/Level/encoding-down/compare/v2.0.2...v2.0.3 | ||
[2.0.2]: https://github.com/level/encoding-down/compare/v2.0.1...v2.0.2 | ||
[2.0.2]: https://github.com/Level/encoding-down/compare/v2.0.1...v2.0.2 | ||
[2.0.1]: https://github.com/level/encoding-down/compare/v2.0.0...v2.0.1 | ||
[2.0.1]: https://github.com/Level/encoding-down/compare/v2.0.0...v2.0.1 | ||
[2.0.0]: https://github.com/level/encoding-down/compare/v1.0.0...v2.0.0 | ||
[2.0.0]: https://github.com/Level/encoding-down/compare/v1.0.0...v2.0.0 |
@@ -80,2 +80,7 @@ 'use strict' | ||
DB.prototype._clear = function (opts, callback) { | ||
opts = this.codec.encodeLtgt(opts) | ||
this.db.clear(opts, callback) | ||
} | ||
DB.prototype.approximateSize = function (start, end, opts, cb) { | ||
@@ -82,0 +87,0 @@ start = this.codec.encodeKey(start, opts) |
{ | ||
"name": "encoding-down", | ||
"version": "6.1.0", | ||
"version": "6.2.0", | ||
"description": "LevelDOWN wrapper supporting levelup@1 encodings", | ||
@@ -15,3 +15,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"abstract-leveldown": "^6.0.0", | ||
"abstract-leveldown": "^6.1.1", | ||
"inherits": "^2.0.3", | ||
@@ -24,8 +24,8 @@ "level-codec": "^9.0.0", | ||
"dependency-check": "^3.3.0", | ||
"hallmark": "^0.1.0", | ||
"hallmark": "^2.0.0", | ||
"level-community": "^3.0.0", | ||
"memdown": "^4.0.0", | ||
"memdown": "^5.0.0", | ||
"nyc": "^14.0.0", | ||
"safe-buffer": "^5.1.1", | ||
"standard": "^12.0.0", | ||
"standard": "^14.0.0", | ||
"tape": "^4.8.0" | ||
@@ -32,0 +32,0 @@ }, |
@@ -5,2 +5,3 @@ var test = require('tape') | ||
var Buffer = require('safe-buffer').Buffer | ||
var hasOwnProperty = Object.prototype.hasOwnProperty | ||
var noop = function () {} | ||
@@ -49,3 +50,3 @@ | ||
batch: function (ops, options, callback) { | ||
t.same(ops, [ { type: 'put', key: '3', value: '4' } ]) | ||
t.same(ops, [{ type: 'put', key: '3', value: '4' }]) | ||
} | ||
@@ -405,2 +406,27 @@ }) | ||
test('iterator encodes range options', function (t) { | ||
t.plan(7) | ||
var keyEncoding = { | ||
encode: function (key) { | ||
return 'encoded_' + key | ||
}, | ||
buffer: false | ||
} | ||
var db = encdown({ | ||
iterator: function (options) { | ||
t.is(options.start, 'encoded_1') | ||
t.is(options.end, 'encoded_2') | ||
t.is(options.gt, 'encoded_3') | ||
t.is(options.gte, 'encoded_4') | ||
t.is(options.lt, 'encoded_5') | ||
t.is(options.lte, 'encoded_6') | ||
t.is(options.foo, 7) | ||
} | ||
}, { keyEncoding }) | ||
db.iterator({ start: 1, end: 2, gt: 3, gte: 4, lt: 5, lte: 6, foo: 7 }) | ||
}) | ||
test('iterator does not strip nullish range options', function (t) { | ||
@@ -425,6 +451,6 @@ t.plan(12) | ||
iterator: function (options) { | ||
t.ok(options.hasOwnProperty('gt')) | ||
t.ok(options.hasOwnProperty('gte')) | ||
t.ok(options.hasOwnProperty('lt')) | ||
t.ok(options.hasOwnProperty('lte')) | ||
t.ok(hasOwnProperty.call(options, 'gt')) | ||
t.ok(hasOwnProperty.call(options, 'gte')) | ||
t.ok(hasOwnProperty.call(options, 'lt')) | ||
t.ok(hasOwnProperty.call(options, 'lte')) | ||
@@ -449,6 +475,6 @@ t.is(options.gt, undefined) | ||
iterator: function (options) { | ||
t.notOk(options.hasOwnProperty('gt')) | ||
t.notOk(options.hasOwnProperty('gte')) | ||
t.notOk(options.hasOwnProperty('lt')) | ||
t.notOk(options.hasOwnProperty('lte')) | ||
t.notOk(hasOwnProperty.call(options, 'gt')) | ||
t.notOk(hasOwnProperty.call(options, 'gte')) | ||
t.notOk(hasOwnProperty.call(options, 'lt')) | ||
t.notOk(hasOwnProperty.call(options, 'lte')) | ||
} | ||
@@ -631,1 +657,102 @@ }).iterator({}) | ||
}) | ||
test('clear() forwards default options', function (t) { | ||
t.plan(3) | ||
var down = { | ||
clear: function (options, callback) { | ||
t.is(options.reverse, false) | ||
t.is(options.limit, -1) | ||
t.is(callback, noop) | ||
} | ||
} | ||
encdown(down).clear(noop) | ||
}) | ||
test('clear() forwards error from underlying store', function (t) { | ||
t.plan(1) | ||
var down = { | ||
clear: function (options, cb) { | ||
process.nextTick(cb, new Error('error from store')) | ||
} | ||
} | ||
encdown(down).clear(function (err) { | ||
t.is(err.message, 'error from store') | ||
}) | ||
}) | ||
test('clear() encodes range options', function (t) { | ||
t.plan(5) | ||
var keyEncoding = { | ||
encode: function (key) { | ||
return 'encoded_' + key | ||
}, | ||
buffer: false | ||
} | ||
var db = encdown({ | ||
clear: function (options) { | ||
t.is(options.gt, 'encoded_1') | ||
t.is(options.gte, 'encoded_2') | ||
t.is(options.lt, 'encoded_3') | ||
t.is(options.lte, 'encoded_4') | ||
t.is(options.foo, 5) | ||
} | ||
}, { keyEncoding }) | ||
db.clear({ gt: 1, gte: 2, lt: 3, lte: 4, foo: 5 }, noop) | ||
}) | ||
test('clear() does not strip nullish range options', function (t) { | ||
t.plan(12) | ||
encdown({ | ||
clear: function (options) { | ||
t.is(options.gt, null) | ||
t.is(options.gte, null) | ||
t.is(options.lt, null) | ||
t.is(options.lte, null) | ||
} | ||
}).clear({ | ||
gt: null, | ||
gte: null, | ||
lt: null, | ||
lte: null | ||
}, noop) | ||
encdown({ | ||
clear: function (options) { | ||
t.ok(hasOwnProperty.call(options, 'gt')) | ||
t.ok(hasOwnProperty.call(options, 'gte')) | ||
t.ok(hasOwnProperty.call(options, 'lt')) | ||
t.ok(hasOwnProperty.call(options, 'lte')) | ||
t.is(options.gt, undefined) | ||
t.is(options.gte, undefined) | ||
t.is(options.lt, undefined) | ||
t.is(options.lte, undefined) | ||
} | ||
}).clear({ | ||
gt: undefined, | ||
gte: undefined, | ||
lt: undefined, | ||
lte: undefined | ||
}, noop) | ||
}) | ||
test('clear() does not add nullish range options', function (t) { | ||
t.plan(4) | ||
encdown({ | ||
clear: function (options) { | ||
t.notOk(hasOwnProperty.call(options, 'gt')) | ||
t.notOk(hasOwnProperty.call(options, 'gte')) | ||
t.notOk(hasOwnProperty.call(options, 'lt')) | ||
t.notOk(hasOwnProperty.call(options, 'lte')) | ||
} | ||
}).clear({}, noop) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43818
761
Updatedabstract-leveldown@^6.1.1