@@ -359,6 +359,7 @@ RedisClient.prototype.on_info_cmd = function (err, res) {
359359 } ) ;
360360
361361 obj . versions = [ ] ;
362+ /* istanbul ignore else: some redis servers do not send the version */
362363 if ( obj . redis_version ) {
363364 obj . redis_version . split ( '.' ) . forEach ( function ( num ) {
364365 obj . versions . push ( + num ) ;
@@ -572,8 +573,7 @@ RedisClient.prototype.return_reply = function (reply) {
572573
573574 if ( this . pub_sub_mode && ( type === 'message' || type === 'pmessage' ) ) {
574575 debug ( "Received pubsub message" ) ;
575- }
576- else {
576+ } else {
577577 command_obj = this . command_queue . shift ( ) ;
578578 }
579579
@@ -660,7 +660,7 @@ function Command(command, args, sub_command, buffer_args, callback) {
660660}
661661
662662RedisClient . 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 ;
664664
665665 if ( typeof command !== "string" ) {
666666 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) {
718718 }
719719
720720 buffer_args = false ;
721- for ( i = 0 , il = args . length , arg ; i < il ; i += 1 ) {
721+ for ( i = 0 ; i < args . length ; i += 1 ) {
722722 if ( Buffer . isBuffer ( args [ i ] ) ) {
723723 buffer_args = true ;
724+ break ;
724725 }
725726 }
726727
@@ -768,7 +769,7 @@ RedisClient.prototype.send_command = function (command, args, callback) {
768769 command_str = "*" + elem_count + "\r\n$" + command . length + "\r\n" + command + "\r\n" ;
769770
770771 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 ) {
772773 arg = args [ i ] ;
773774 if ( typeof arg !== "string" ) {
774775 arg = String ( arg ) ;
@@ -781,7 +782,7 @@ RedisClient.prototype.send_command = function (command, args, callback) {
781782 debug ( "Send command (" + command_str + ") has Buffer arguments" ) ;
782783 buffered_writes += ! stream . write ( command_str ) ;
783784
784- for ( i = 0 , il = args . length , arg ; i < il ; i += 1 ) {
785+ for ( i = 0 ; i < args . length ; i += 1 ) {
785786 arg = args [ i ] ;
786787 if ( ! ( Buffer . isBuffer ( arg ) || arg instanceof String ) ) {
787788 arg = String ( arg ) ;
@@ -892,7 +893,7 @@ commands.forEach(function (fullCommand) {
892893} ) ;
893894
894895// 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 ) {
896897 var self = this ;
897898
898899 this . send_command ( 'select' , [ db ] , function ( err , res ) {
@@ -906,22 +907,18 @@ RedisClient.prototype.select = function (db, callback) {
906907 }
907908 } ) ;
908909} ;
909- RedisClient . prototype . SELECT = RedisClient . prototype . select ;
910910
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 ;
916915 debug ( "Saving auth as " + this . auth_pass ) ;
917-
918916 if ( this . connected ) {
919- this . send_command ( "auth" , args ) ;
917+ this . send_command ( "auth" , pass , callback ) ;
920918 }
921919} ;
922- RedisClient . prototype . AUTH = RedisClient . prototype . auth ;
923920
924- RedisClient . prototype . hmget = function ( arg1 , arg2 , arg3 ) {
921+ RedisClient . prototype . hmget = RedisClient . prototype . HMGET = function ( arg1 , arg2 , arg3 ) {
925922 if ( Array . isArray ( arg2 ) && typeof arg3 === "function" ) {
926923 return this . send_command ( "hmget" , [ arg1 ] . concat ( arg2 ) , arg3 ) ;
927924 } else if ( Array . isArray ( arg1 ) && typeof arg2 === "function" ) {
@@ -930,9 +927,8 @@ RedisClient.prototype.hmget = function (arg1, arg2, arg3) {
930927 return this . send_command ( "hmget" , to_array ( arguments ) ) ;
931928 }
932929} ;
933- RedisClient . prototype . HMGET = RedisClient . prototype . hmget ;
934930
935- RedisClient . prototype . hmset = function ( args , callback ) {
931+ RedisClient . prototype . hmset = RedisClient . prototype . HMSET = function ( args , callback ) {
936932 var tmp_args , tmp_keys , i , il , key ;
937933
938934 if ( Array . isArray ( args ) ) {
@@ -968,9 +964,8 @@ RedisClient.prototype.hmset = function (args, callback) {
968964
969965 return this . send_command ( "hmset" , args , callback ) ;
970966} ;
971- RedisClient . prototype . HMSET = RedisClient . prototype . hmset ;
972967
973- Multi . prototype . hmset = function ( ) {
968+ Multi . prototype . hmset = Multi . prototype . HMSET = function ( ) {
974969 var args = to_array ( arguments ) , tmp_args ;
975970 if ( args . length >= 2 && typeof args [ 0 ] === "string" && typeof args [ 1 ] === "object" ) {
976971 tmp_args = [ "hmset" , args [ 0 ] ] ;
@@ -989,9 +984,8 @@ Multi.prototype.hmset = function () {
989984 this . queue . push ( args ) ;
990985 return this ;
991986} ;
992- Multi . prototype . HMSET = Multi . prototype . hmset ;
993987
994- Multi . prototype . exec = function ( callback ) {
988+ Multi . prototype . exec = Multi . prototype . EXEC = function ( callback ) {
995989 var self = this ;
996990 var errors = [ ] ;
997991 var wants_buffers = [ ] ;
@@ -1075,13 +1069,10 @@ Multi.prototype.exec = function (callback) {
10751069 }
10761070 } ) ;
10771071} ;
1078- Multi . prototype . EXEC = Multi . prototype . exec ;
10791072
1080- RedisClient . prototype . multi = function ( args ) {
1073+ RedisClient . prototype . multi = RedisClient . prototype . MULTI = function ( args ) {
10811074 return new Multi ( this , args ) ;
10821075} ;
1083- RedisClient . prototype . MULTI = RedisClient . prototype . multi ;
1084-
10851076
10861077// stash original eval method
10871078var eval_orig = RedisClient . prototype . eval ;
0 commit comments