From d329d6e92f950a4e2baee5543d88628733818123 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 3 Apr 2016 03:02:19 -0700 Subject: [PATCH] add batch.clear to bst. --- lib/bcoin/bst.js | 8 +++++++- package.json | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/bcoin/bst.js b/lib/bcoin/bst.js index 15cf39bd..ff96e6ae 100644 --- a/lib/bcoin/bst.js +++ b/lib/bcoin/bst.js @@ -493,6 +493,12 @@ Batch.prototype.write = function write(callback) { return this; }; +Batch.prototype.clear = function clear(callback) { + assert(this.tree, 'Already written.'); + this.ops.length = 0; + return this; +}; + /** * Iterator */ @@ -560,7 +566,7 @@ Iterator.prototype.next = function(callback) { if (this.options.valueAsBuffer === false) value = value.toString('utf8'); - return utils.asyncify(callback)(null, key, value); + utils.asyncify(callback)(null, key, value); }; Iterator.prototype.seek = function seek(key) { diff --git a/package.json b/package.json index a13f729b..b0e8b92c 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,6 @@ "browserify": "13.0.0", "hash.js": "1.0.3", "level-js": "2.2.3", - "memdown": "1.1.2", "mocha": "1.21.5", "uglify-js": "2.6.1", "v8-profiler": "5.6.0"