[Pkg-javascript-commits] [node-leveldown] 169/492: minor style tweaks take 2

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:13:56 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 0fd2c8d530938c5445b87934bbe8ef5f9a0a5699
Author: Rod Vagg <rod at vagg.org>
Date:   Sun Jan 20 16:34:53 2013 +1100

    minor style tweaks take 2
---
 lib/levelup.js | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/lib/levelup.js b/lib/levelup.js
index 4fdefcf..9c3316c 100644
--- a/lib/levelup.js
+++ b/lib/levelup.js
@@ -154,6 +154,7 @@ LevelUP.prototype.get = function (key_, options_, callback_) {
     valueEnc = options.valueEncoding || options.encoding
     key      = toSlice[keyEnc](key_)
     options.asBuffer = valueEnc != 'utf8' && valueEnc != 'json'
+
     this._db.get(key, options, function (err, value) {
       if (err) {
         err = new errors.NotFoundError('Key not found in database [' + key_ + ']')
@@ -189,6 +190,7 @@ LevelUP.prototype.put = function (key_, value_, options_, callback_) {
     options  = getOptions(options_, this._options)
     key      = toSlice[options.keyEncoding   || options.encoding](key_)
     value    = toSlice[options.valueEncoding || options.encoding](value_)
+
     this._db.put(key, value, options, function (err) {
       if (err) {
         err = new errors.WriteError(err)
@@ -271,6 +273,7 @@ LevelUP.prototype.batch = function (arr_, options_, callback_) {
   // encode the keys and/or values. This includes JSON types.
   if ((keyEncoding != 'utf8' && keyEncoding != 'binary')
       || (valueEncoding != 'utf8' && valueEncoding != 'binary')) {
+
     arr = arr_.map(function (e) {
       if (e.type !== undefined && e.key !== undefined) {
         var o = {
@@ -283,8 +286,10 @@ LevelUP.prototype.batch = function (arr_, options_, callback_) {
       }
       return {}
     })
-  } else
+  } else {
     arr = arr_
+  }
+
   this._db.batch(arr, options, function (err) {
     if (err) {
       err = new errors.WriteError(err)
@@ -329,7 +334,7 @@ LevelUP.prototype.approximateSize = function(start, end, callback) {
 LevelUP.prototype.readStream = function (options) {
   options = extend(extend({}, this._options), typeof options == 'object' ? options : {})
   return readStream.create(
-    options
+      options
     , this
     , function (options) {
         return bridge.createIterator(this._db, options)
@@ -338,16 +343,22 @@ LevelUP.prototype.readStream = function (options) {
 }
 
 LevelUP.prototype.keyStream = function (options) {
-  return this.readStream(extend(options ? extend({}, options) : {}, { keys: true, values: false }))
+  return this.readStream(
+      extend(options ? extend({}, options) : {}
+    , { keys: true, values: false })
+  )
 }
 
 LevelUP.prototype.valueStream = function (options) {
-  return this.readStream(extend(options ? extend({}, options) : {}, { keys: false, values: true }))
+  return this.readStream(
+      extend(options ? extend({}, options) : {}
+    , { keys: false, values: true })
+  )
 }
 
 LevelUP.prototype.writeStream = function (options) {
   return writeStream.create(
-    options || {}
+      options || {}
     , this
   )
 }
@@ -378,4 +389,4 @@ module.exports = function (location, options, callback) {
   return levelup
 }
 
-module.exports.copy = require('./util').copy
+module.exports.copy = require('./util').copy
\ 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