Skip to content

Instantly share code, notes, and snippets.

@gmaclennan
Created February 4, 2017 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmaclennan/39ed55d619bf57cd0cc29a6c210f515b to your computer and use it in GitHub Desktop.
Save gmaclennan/39ed55d619bf57cd0cc29a6c210f515b to your computer and use it in GitHub Desktop.
Patch for hyperkv 2.0.0
diff --git a/index.js b/index.js
index 79f78e4..e9897c0 100644
--- a/index.js
+++ b/index.js
@@ -101,7 +101,8 @@ KV.prototype.del = function (key, opts, cb) {
}
if (!opts) opts = {}
if (!cb) cb = noop
- self._put(key, { d: key }, opts, function (err, node) {
+ var value = xtend(opts.fields || {}, { k: key, d: true, v: opts.value })
+ self._put(key, value, opts, function (err, node) {
cb(err, node)
if (!err) self.emit('del', key, node)
})
@@ -264,7 +265,7 @@ KV.prototype.batch = function (rows, opts, cb) {
})
} else if (row.type === 'del') {
batch.push({
- value: xtend(row.fields || {}, { d: row.key }),
+ value: xtend(row.fields || {}, { k: row.key, d: true, v: row.value }),
links: row.links
})
} else if (row.type) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment