@ -624,14 +624,14 @@ RedisClient.prototype.return_reply = function (reply) {
if ( command_obj && ! command_obj . sub_command ) {
if ( command_obj && ! command_obj . sub_command ) {
if ( typeof command_obj . callback === "function" ) {
if ( typeof command_obj . callback === "function" ) {
if ( this . options . detect_buffers && command_obj . buffer_args === false && 'exec' !== command_obj . command . toLowerCase ( ) ) {
if ( this . options . detect_buffers && command_obj . buffer_args === false && 'exec' !== command_obj . command ) {
// If detect_buffers option was specified, then the reply from the parser will be Buffers.
// If detect_buffers option was specified, then the reply from the parser will be Buffers.
// If this command did not use Buffer arguments, then convert the reply to Strings here.
// If this command did not use Buffer arguments, then convert the reply to Strings here.
reply = reply_to_strings ( reply ) ;
reply = reply_to_strings ( reply ) ;
}
}
// TODO - confusing and error-prone that hgetall is special cased in two places
// TODO - confusing and error-prone that hgetall is special cased in two places
if ( reply && 'hgetall' === command_obj . command . toLowerCase ( ) ) {
if ( reply && 'hgetall' === command_obj . command ) {
reply = reply_to_object ( reply ) ;
reply = reply_to_object ( reply ) ;
}
}
@ -730,8 +730,7 @@ RedisClient.prototype.send_command = function (command, args, callback) {
// client.sadd(arg1, [arg2, arg3, arg4], cb);
// client.sadd(arg1, [arg2, arg3, arg4], cb);
// converts to:
// converts to:
// client.sadd(arg1, arg2, arg3, arg4, cb);
// client.sadd(arg1, arg2, arg3, arg4, cb);
lcaseCommand = command . toLowerCase ( ) ;
if ( ( command === 'sadd' || command === 'srem' ) && args . length > 0 && Array . isArray ( args [ args . length - 1 ] ) ) {
if ( ( lcaseCommand === 'sadd' || lcaseCommand === 'srem' ) && args . length > 0 && Array . isArray ( args [ args . length - 1 ] ) ) {
args = args . slice ( 0 , - 1 ) . concat ( args [ args . length - 1 ] ) ;
args = args . slice ( 0 , - 1 ) . concat ( args [ args . length - 1 ] ) ;
}
}
@ -885,7 +884,7 @@ RedisClient.prototype.end = function () {
function Multi ( client , args ) {
function Multi ( client , args ) {
this . _ client = client ;
this . _ client = client ;
this . queue = [ [ "MULTI " ] ] ;
this . queue = [ [ "multi " ] ] ;
if ( Array . isArray ( args ) ) {
if ( Array . isArray ( args ) ) {
this . queue = this . queue . concat ( args ) ;
this . queue = this . queue . concat ( args ) ;
}
}
@ -1061,7 +1060,7 @@ Multi.prototype.exec = function (callback) {
if ( args . length === 1 && Array . isArray ( args [ 0 ] ) ) {
if ( args . length === 1 && Array . isArray ( args [ 0 ] ) ) {
args = args [ 0 ] ;
args = args [ 0 ] ;
}
}
if ( command . toLowerCase ( ) === 'hmset' && typeof args [ 1 ] === 'object' ) {
if ( command === 'hmset' && typeof args [ 1 ] === 'object' ) {
obj = args . pop ( ) ;
obj = args . pop ( ) ;
Object . keys ( obj ) . forEach ( function ( key ) {
Object . keys ( obj ) . forEach ( function ( key ) {
args . push ( key ) ;
args . push ( key ) ;
@ -1081,7 +1080,7 @@ Multi.prototype.exec = function (callback) {
} , this ) ;
} , this ) ;
// TODO - make this callback part of Multi.prototype instead of creating it each time
// TODO - make this callback part of Multi.prototype instead of creating it each time
return this . _ client . send_command ( "EXEC " , [ ] , function ( err , replies ) {
return this . _ client . send_command ( "exec " , [ ] , function ( err , replies ) {
if ( err ) {
if ( err ) {
if ( callback ) {
if ( callback ) {
errors . push ( new Error ( err ) ) ;
errors . push ( new Error ( err ) ) ;
@ -1106,7 +1105,7 @@ Multi.prototype.exec = function (callback) {
}
}
// TODO - confusing and error-prone that hgetall is special cased in two places
// TODO - confusing and error-prone that hgetall is special cased in two places
if ( reply && args [ 0 ] . toLowerCase ( ) === "hgetall" ) {
if ( reply && args [ 0 ] === "hgetall" ) {
replies [ i - 1 ] = reply = reply_to_object ( reply ) ;
replies [ i - 1 ] = reply = reply_to_object ( reply ) ;
}
}