You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
Whitespace and other JSHint changes.
This commit is contained in:
32
index.js
32
index.js
@@ -130,8 +130,7 @@ RedisClient.prototype.flush_and_error = function (message) {
|
||||
};
|
||||
|
||||
RedisClient.prototype.on_error = function (msg) {
|
||||
var message = "Redis connection to " + this.host + ":" + this.port + " failed - " + msg,
|
||||
self = this, command_obj;
|
||||
var message = "Redis connection to " + this.host + ":" + this.port + " failed - " + msg;
|
||||
|
||||
if (this.closing) {
|
||||
return;
|
||||
@@ -198,7 +197,6 @@ RedisClient.prototype.on_connect = function () {
|
||||
if (exports.debug_mode) {
|
||||
console.log("Stream connected " + this.host + ":" + this.port + " id " + this.connection_id);
|
||||
}
|
||||
var self = this;
|
||||
|
||||
this.connected = true;
|
||||
this.ready = false;
|
||||
@@ -289,12 +287,12 @@ RedisClient.prototype.on_ready = function () {
|
||||
if (this.pub_sub_mode === true) {
|
||||
// only emit "ready" when all subscriptions were made again
|
||||
var callback_count = 0;
|
||||
var callback = function() {
|
||||
var callback = function () {
|
||||
callback_count--;
|
||||
if (callback_count == 0) {
|
||||
if (callback_count === 0) {
|
||||
self.emit("ready");
|
||||
}
|
||||
}
|
||||
};
|
||||
Object.keys(this.subscription_set).forEach(function (key) {
|
||||
var parts = key.split(" ");
|
||||
if (exports.debug_mode) {
|
||||
@@ -389,7 +387,7 @@ RedisClient.prototype.send_offline_queue = function () {
|
||||
};
|
||||
|
||||
RedisClient.prototype.connection_gone = function (why) {
|
||||
var self = this, message;
|
||||
var self = this;
|
||||
|
||||
// If a retry is already in progress, just let that happen
|
||||
if (this.retry_timer) {
|
||||
@@ -562,7 +560,7 @@ function reply_to_strings(reply) {
|
||||
}
|
||||
|
||||
RedisClient.prototype.return_reply = function (reply) {
|
||||
var command_obj, obj, i, len, type, timestamp, argindex, args, queue_len;
|
||||
var command_obj, len, type, timestamp, argindex, args, queue_len;
|
||||
|
||||
command_obj = this.command_queue.shift(),
|
||||
queue_len = this.command_queue.getLength();
|
||||
@@ -646,7 +644,7 @@ function Command(command, args, sub_command, buffer_args, callback) {
|
||||
}
|
||||
|
||||
RedisClient.prototype.send_command = function (command, args, callback) {
|
||||
var arg, this_args, command_obj, i, il, elem_count, buffer_args, stream = this.stream, command_str = "", buffered_writes = 0, last_arg_type;
|
||||
var arg, command_obj, i, il, elem_count, buffer_args, stream = this.stream, command_str = "", buffered_writes = 0, last_arg_type;
|
||||
|
||||
if (typeof command !== "string") {
|
||||
throw new Error("First argument to send_command must be the command name string, not " + typeof command);
|
||||
@@ -948,8 +946,11 @@ RedisClient.prototype.hmset = function (args, callback) {
|
||||
tmp_args.push(key);
|
||||
if (typeof args[1][key] !== "string") {
|
||||
var err = new Error("hmset expected value to be a string", key, ":", args[1][key]);
|
||||
if (callback) return callback(err);
|
||||
else throw err;
|
||||
if (callback) {
|
||||
return callback(err);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
tmp_args.push(args[1][key]);
|
||||
}
|
||||
@@ -1027,7 +1028,7 @@ Multi.prototype.exec = function (callback) {
|
||||
}
|
||||
}
|
||||
|
||||
var i, il, j, jl, reply, args;
|
||||
var i, il, reply, args;
|
||||
|
||||
if (replies) {
|
||||
for (i = 1, il = self.queue.length; i < il; i += 1) {
|
||||
@@ -1061,10 +1062,9 @@ RedisClient.prototype.MULTI = function (args) {
|
||||
|
||||
|
||||
// stash original eval method
|
||||
var eval = RedisClient.prototype.eval;
|
||||
var eval_orig = RedisClient.prototype.eval;
|
||||
// hook eval with an attempt to evalsha for cached scripts
|
||||
RedisClient.prototype.eval =
|
||||
RedisClient.prototype.EVAL = function () {
|
||||
RedisClient.prototype.eval = RedisClient.prototype.EVAL = function () {
|
||||
var self = this,
|
||||
args = to_array(arguments),
|
||||
callback;
|
||||
@@ -1080,7 +1080,7 @@ RedisClient.prototype.EVAL = function () {
|
||||
self.evalsha(args, function (err, reply) {
|
||||
if (err && /NOSCRIPT/.test(err.message)) {
|
||||
args[0] = source;
|
||||
eval.call(self, args, callback);
|
||||
eval_orig.call(self, args, callback);
|
||||
|
||||
} else if (callback) {
|
||||
callback(err, reply);
|
||||
|
Reference in New Issue
Block a user