@@ -1228,50 +1228,29 @@ RedisClient.prototype.eval = RedisClient.prototype.EVAL = function () {
1228
1228
} ) ;
1229
1229
} ;
1230
1230
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 || { } ;
1231
1241
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 ) ;
1249
1243
if ( parsed . hostname ) {
1250
1244
if ( parsed . auth ) {
1251
1245
options . auth_pass = parsed . auth . split ( ':' ) [ 1 ] ;
1252
1246
}
1253
- // createClient(3000, host, options)
1254
1247
return createClient_tcp ( ( parsed . port || default_port ) , parsed . hostname , options ) ;
1255
- } else {
1256
- // createClient( '/tmp/redis.sock', options)
1257
- return createClient_unix ( arg0 , options ) ;
1258
1248
}
1259
1249
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 ) ;
1273
1251
}
1274
- }
1252
+ throw new Error ( 'unknown type of connection in createClient()' ) ;
1253
+ } ;
1275
1254
1276
1255
var createClient_unix = function ( path , options ) {
1277
1256
var cnxOptions = {
0 commit comments