@@ -359,6 +359,7 @@ RedisClient.prototype.on_info_cmd = function (err, res) {
359
359
} ) ;
360
360
361
361
obj . versions = [ ] ;
362
+ /* istanbul ignore else: some redis servers do not send the version */
362
363
if ( obj . redis_version ) {
363
364
obj . redis_version . split ( '.' ) . forEach ( function ( num ) {
364
365
obj . versions . push ( + num ) ;
@@ -572,8 +573,7 @@ RedisClient.prototype.return_reply = function (reply) {
572
573
573
574
if ( this . pub_sub_mode && ( type === 'message' || type === 'pmessage' ) ) {
574
575
debug ( "Received pubsub message" ) ;
575
- }
576
- else {
576
+ } else {
577
577
command_obj = this . command_queue . shift ( ) ;
578
578
}
579
579
@@ -660,7 +660,7 @@ function Command(command, args, sub_command, buffer_args, callback) {
660
660
}
661
661
662
662
RedisClient . prototype . send_command = function ( command , args , callback ) {
663
- var arg , command_obj , i , il , elem_count , buffer_args , stream = this . stream , command_str = "" , buffered_writes = 0 , last_arg_type ;
663
+ var arg , command_obj , i , elem_count , buffer_args , stream = this . stream , command_str = "" , buffered_writes = 0 , last_arg_type ;
664
664
665
665
if ( typeof command !== "string" ) {
666
666
throw new Error ( "First argument to send_command must be the command name string, not " + typeof command ) ;
@@ -718,9 +718,10 @@ RedisClient.prototype.send_command = function (command, args, callback) {
718
718
}
719
719
720
720
buffer_args = false ;
721
- for ( i = 0 , il = args . length , arg ; i < il ; i += 1 ) {
721
+ for ( i = 0 ; i < args . length ; i += 1 ) {
722
722
if ( Buffer . isBuffer ( args [ i ] ) ) {
723
723
buffer_args = true ;
724
+ break ;
724
725
}
725
726
}
726
727
@@ -768,7 +769,7 @@ RedisClient.prototype.send_command = function (command, args, callback) {
768
769
command_str = "*" + elem_count + "\r\n$" + command . length + "\r\n" + command + "\r\n" ;
769
770
770
771
if ( ! buffer_args ) { // Build up a string and send entire command in one write
771
- for ( i = 0 , il = args . length , arg ; i < il ; i += 1 ) {
772
+ for ( i = 0 ; i < args . length ; i += 1 ) {
772
773
arg = args [ i ] ;
773
774
if ( typeof arg !== "string" ) {
774
775
arg = String ( arg ) ;
@@ -781,7 +782,7 @@ RedisClient.prototype.send_command = function (command, args, callback) {
781
782
debug ( "Send command (" + command_str + ") has Buffer arguments" ) ;
782
783
buffered_writes += ! stream . write ( command_str ) ;
783
784
784
- for ( i = 0 , il = args . length , arg ; i < il ; i += 1 ) {
785
+ for ( i = 0 ; i < args . length ; i += 1 ) {
785
786
arg = args [ i ] ;
786
787
if ( ! ( Buffer . isBuffer ( arg ) || arg instanceof String ) ) {
787
788
arg = String ( arg ) ;
@@ -892,7 +893,7 @@ commands.forEach(function (fullCommand) {
892
893
} ) ;
893
894
894
895
// store db in this.select_db to restore it on reconnect
895
- RedisClient . prototype . select = function ( db , callback ) {
896
+ RedisClient . prototype . select = RedisClient . prototype . SELECT = function ( db , callback ) {
896
897
var self = this ;
897
898
898
899
this . send_command ( 'select' , [ db ] , function ( err , res ) {
@@ -906,22 +907,18 @@ RedisClient.prototype.select = function (db, callback) {
906
907
}
907
908
} ) ;
908
909
} ;
909
- RedisClient . prototype . SELECT = RedisClient . prototype . select ;
910
910
911
- // Stash auth for connect and reconnect. Send immediately if already connected.
912
- RedisClient . prototype . auth = function ( ) {
913
- var args = to_array ( arguments ) ;
914
- this . auth_pass = args [ 0 ] ;
915
- this . auth_callback = args [ 1 ] ;
911
+ // Stash auth for connect and reconnect. Send immediately if already connected.
912
+ RedisClient . prototype . auth = RedisClient . prototype . AUTH = function ( pass , callback ) {
913
+ this . auth_pass = pass ;
914
+ this . auth_callback = callback ;
916
915
debug ( "Saving auth as " + this . auth_pass ) ;
917
-
918
916
if ( this . connected ) {
919
- this . send_command ( "auth" , args ) ;
917
+ this . send_command ( "auth" , pass , callback ) ;
920
918
}
921
919
} ;
922
- RedisClient . prototype . AUTH = RedisClient . prototype . auth ;
923
920
924
- RedisClient . prototype . hmget = function ( arg1 , arg2 , arg3 ) {
921
+ RedisClient . prototype . hmget = RedisClient . prototype . HMGET = function ( arg1 , arg2 , arg3 ) {
925
922
if ( Array . isArray ( arg2 ) && typeof arg3 === "function" ) {
926
923
return this . send_command ( "hmget" , [ arg1 ] . concat ( arg2 ) , arg3 ) ;
927
924
} else if ( Array . isArray ( arg1 ) && typeof arg2 === "function" ) {
@@ -930,9 +927,8 @@ RedisClient.prototype.hmget = function (arg1, arg2, arg3) {
930
927
return this . send_command ( "hmget" , to_array ( arguments ) ) ;
931
928
}
932
929
} ;
933
- RedisClient . prototype . HMGET = RedisClient . prototype . hmget ;
934
930
935
- RedisClient . prototype . hmset = function ( args , callback ) {
931
+ RedisClient . prototype . hmset = RedisClient . prototype . HMSET = function ( args , callback ) {
936
932
var tmp_args , tmp_keys , i , il , key ;
937
933
938
934
if ( Array . isArray ( args ) ) {
@@ -968,9 +964,8 @@ RedisClient.prototype.hmset = function (args, callback) {
968
964
969
965
return this . send_command ( "hmset" , args , callback ) ;
970
966
} ;
971
- RedisClient . prototype . HMSET = RedisClient . prototype . hmset ;
972
967
973
- Multi . prototype . hmset = function ( ) {
968
+ Multi . prototype . hmset = Multi . prototype . HMSET = function ( ) {
974
969
var args = to_array ( arguments ) , tmp_args ;
975
970
if ( args . length >= 2 && typeof args [ 0 ] === "string" && typeof args [ 1 ] === "object" ) {
976
971
tmp_args = [ "hmset" , args [ 0 ] ] ;
@@ -989,9 +984,8 @@ Multi.prototype.hmset = function () {
989
984
this . queue . push ( args ) ;
990
985
return this ;
991
986
} ;
992
- Multi . prototype . HMSET = Multi . prototype . hmset ;
993
987
994
- Multi . prototype . exec = function ( callback ) {
988
+ Multi . prototype . exec = Multi . prototype . EXEC = function ( callback ) {
995
989
var self = this ;
996
990
var errors = [ ] ;
997
991
var wants_buffers = [ ] ;
@@ -1075,13 +1069,10 @@ Multi.prototype.exec = function (callback) {
1075
1069
}
1076
1070
} ) ;
1077
1071
} ;
1078
- Multi . prototype . EXEC = Multi . prototype . exec ;
1079
1072
1080
- RedisClient . prototype . multi = function ( args ) {
1073
+ RedisClient . prototype . multi = RedisClient . prototype . MULTI = function ( args ) {
1081
1074
return new Multi ( this , args ) ;
1082
1075
} ;
1083
- RedisClient . prototype . MULTI = RedisClient . prototype . multi ;
1084
-
1085
1076
1086
1077
// stash original eval method
1087
1078
var eval_orig = RedisClient . prototype . eval ;
0 commit comments