encoding-down
Advanced tools
+13
-1
@@ -5,2 +5,12 @@ # Changelog | ||
| ## [6.1.0] - 2019-06-22 | ||
| ### Changed | ||
| - Upgrade `nyc` devDependency from `^13.2.0` to `^14.0.0` ([#81](https://github.com/Level/encoding-down/issues/81))) ([**@vweevers**](https://github.com/vweevers)) | ||
| ### Added | ||
| - Support seeking ([#82](https://github.com/Level/encoding-down/issues/82), [#83](https://github.com/Level/encoding-down/issues/83)) ([**@MeirionHughes**](https://github.com/MeirionHughes), [**@vweevers**](https://github.com/vweevers)) | ||
| ## [6.0.2] - 2019-03-31 | ||
@@ -296,4 +306,6 @@ | ||
| [unreleased]: https://github.com/level/encoding-down/compare/v6.0.2...HEAD | ||
| [unreleased]: https://github.com/level/encoding-down/compare/v6.1.0...HEAD | ||
| [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 | ||
@@ -300,0 +312,0 @@ |
+5
-0
@@ -120,2 +120,7 @@ 'use strict' | ||
| Iterator.prototype._seek = function (key) { | ||
| key = this.codec.encodeKey(key, this.opts) | ||
| this.it.seek(key) | ||
| } | ||
| Iterator.prototype._end = function (cb) { | ||
@@ -122,0 +127,0 @@ this.it.end(cb) |
+2
-2
| { | ||
| "name": "encoding-down", | ||
| "version": "6.0.2", | ||
| "version": "6.1.0", | ||
| "description": "LevelDOWN wrapper supporting levelup@1 encodings", | ||
@@ -26,3 +26,3 @@ "license": "MIT", | ||
| "memdown": "^4.0.0", | ||
| "nyc": "^13.2.0", | ||
| "nyc": "^14.0.0", | ||
| "safe-buffer": "^5.1.1", | ||
@@ -29,0 +29,0 @@ "standard": "^12.0.0", |
+2
-2
@@ -179,3 +179,3 @@ # encoding-down | ||
| To sustain [`Level`](https://github.com/Level) and its activities, become a backer or sponsor on [Open Collective](https://opencollective.com/level). Your logo or avatar will be displayed on our 28+ [GitHub repositories](https://github.com/Level), [npm](https://www.npmjs.com/) packages and (soon) [our website](http://leveldb.org). 💖 | ||
| To sustain [`Level`](https://github.com/Level) and its activities, become a backer or sponsor on [Open Collective](https://opencollective.com/level). Your logo or avatar will be displayed on our 28+ [GitHub repositories](https://github.com/Level) and [npm](https://www.npmjs.com/) packages. 💖 | ||
@@ -194,3 +194,3 @@ ### Backers | ||
| [level-badge]: http://leveldb.org/img/badge.svg | ||
| [level-badge]: https://leveljs.org/img/badge.svg | ||
@@ -197,0 +197,0 @@ [abstract-leveldown]: https://github.com/Level/abstract-leveldown |
+58
-0
@@ -568,1 +568,59 @@ var test = require('tape') | ||
| }) | ||
| test('encodes seek target', function (t) { | ||
| t.plan(1) | ||
| var db = encdown({ | ||
| iterator: function () { | ||
| return { | ||
| seek: function (target) { | ||
| t.is(target, '123', 'encoded number') | ||
| } | ||
| } | ||
| } | ||
| }, { keyEncoding: 'json' }) | ||
| db.iterator().seek(123) | ||
| }) | ||
| test('encodes seek target with custom encoding', function (t) { | ||
| t.plan(1) | ||
| var targets = [] | ||
| var db = encdown({ | ||
| iterator: function () { | ||
| return { | ||
| seek: function (target) { | ||
| targets.push(target) | ||
| } | ||
| } | ||
| } | ||
| }) | ||
| db.iterator().seek('a') | ||
| db.iterator({ keyEncoding: 'json' }).seek('a') | ||
| t.same(targets, ['a', '"a"'], 'encoded targets') | ||
| }) | ||
| test('encodes nullish seek target', function (t) { | ||
| t.plan(1) | ||
| var targets = [] | ||
| var db = encdown({ | ||
| iterator: function () { | ||
| return { | ||
| seek: function (target) { | ||
| targets.push(target) | ||
| } | ||
| } | ||
| } | ||
| }, { keyEncoding: { encode: String } }) | ||
| // Unlike keys, nullish targets should not be rejected; | ||
| // assume that the encoding gives these types meaning. | ||
| db.iterator().seek(null) | ||
| db.iterator().seek(undefined) | ||
| t.same(targets, ['null', 'undefined'], 'encoded') | ||
| }) |
40028
4.65%650
8.51%