@@ -1228,50 +1228,29 @@ RedisClient.prototype.eval = RedisClient.prototype.EVAL = function () {
12281228 } ) ;
12291229} ;
12301230
1231+ exports . createClient = function ( arg0 , arg1 , options ) {
1232+ if ( typeof arg0 === 'object' || arg0 === undefined ) {
1233+ options = arg0 || options ;
1234+ return createClient_tcp ( default_port , default_host , options ) ;
1235+ }
1236+ if ( typeof arg0 === 'number' || typeof arg0 === 'string' && arg0 . match ( / ^ \d + $ / ) ) {
1237+ return createClient_tcp ( arg0 , arg1 , options ) ;
1238+ }
1239+ if ( typeof arg0 === 'string' ) {
1240+ options = arg1 || { } ;
12311241
1232- exports . createClient = function ( arg0 , arg1 , arg2 ) {
1233- if ( arguments . length === 0 ) {
1234-
1235- // createClient()
1236- return createClient_tcp ( default_port , default_host , { } ) ;
1237-
1238- } else if ( typeof arg0 === 'number' ||
1239- typeof arg0 === 'string' && arg0 . match ( / ^ \d + $ / ) ) {
1240-
1241- // createClient( 3000, host, options)
1242- // createClient('3000', host, options)
1243- return createClient_tcp ( arg0 , arg1 , arg2 ) ;
1244-
1245- } else if ( typeof arg0 === 'string' ) {
1246- var parsed = URL . parse ( arg0 , true , true ) ,
1247- options = ( arg1 || { } ) ;
1248-
1242+ var parsed = URL . parse ( arg0 , true , true ) ;
12491243 if ( parsed . hostname ) {
12501244 if ( parsed . auth ) {
12511245 options . auth_pass = parsed . auth . split ( ':' ) [ 1 ] ;
12521246 }
1253- // createClient(3000, host, options)
12541247 return createClient_tcp ( ( parsed . port || default_port ) , parsed . hostname , options ) ;
1255- } else {
1256- // createClient( '/tmp/redis.sock', options)
1257- return createClient_unix ( arg0 , options ) ;
12581248 }
12591249
1260- } else if ( arg0 !== null && typeof arg0 === 'object' ) {
1261-
1262- // createClient(options)
1263- return createClient_tcp ( default_port , default_host , arg0 ) ;
1264-
1265- } else if ( arg0 === null && arg1 === null ) {
1266-
1267- // for backward compatibility
1268- // createClient(null,null,options)
1269- return createClient_tcp ( default_port , default_host , arg2 ) ;
1270-
1271- } else {
1272- throw new Error ( 'unknown type of connection in createClient()' ) ;
1250+ return createClient_unix ( arg0 , options ) ;
12731251 }
1274- }
1252+ throw new Error ( 'unknown type of connection in createClient()' ) ;
1253+ } ;
12751254
12761255var createClient_unix = function ( path , options ) {
12771256 var cnxOptions = {
0 commit comments