[Pkg-javascript-commits] [node-leveldown] 66/492: run the encoding on start and end in case your keys are JSON encoded

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:13:45 UTC 2014


This is an automated email from the git hooks/post-receive script.

andrewrk-guest pushed a commit to annotated tag rocksdb-0.10.1
in repository node-leveldown.

commit ee6cd2040e17955bcd5e842a4e67d6d1ac31e33a
Author: Raynos <raynos2 at gmail.com>
Date:   Sat Nov 17 16:36:59 2012 -0800

    run the encoding on start and end in case your keys are JSON encoded
---
 lib/read-stream.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/read-stream.js b/lib/read-stream.js
index d8ffd65..ce434f5 100644
--- a/lib/read-stream.js
+++ b/lib/read-stream.js
@@ -36,11 +36,12 @@ function ReadStream (options, db, iteratorFactory) {
   // purely to keep `db` around until we're done so it's not GCed if the user doesn't keep a ref
   this._db = db
 
-  this._options = extend(extend({}, defaultOptions), options)
+  options = this._options = extend(extend({}, defaultOptions), options)
+  var keyEncoding = options.keyEncoding || options.encoding
   if (typeof this._options.start !== 'undefined')
-    this._options.start = toBuffer(this._options.start)
+    this._options.start = toBuffer(this._options.start, keyEncoding)
   if (typeof this._options.end !== 'undefined')
-    this._options.end = toBuffer(this._options.end)
+    this._options.end = toBuffer(this._options.end, keyEncoding)
 
   this._makeData = this._options.keys && this._options.values
     ? makeKeyValueData.bind(this) : this._options.keys
@@ -146,4 +147,4 @@ ReadStream.prototype = {
 
 module.exports.create = function (options, db, iteratorFactory) {
   return new ReadStream(options, db, iteratorFactory)
-}
\ No newline at end of file
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-leveldown.git



More information about the Pkg-javascript-commits mailing list