1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Add host and port to options object

This commit is contained in:
Ruben Bridgewater
2015-09-30 02:35:11 +02:00
parent 3c39a8bdfc
commit 977d4dba2b
3 changed files with 34 additions and 3 deletions

View File

@@ -1107,8 +1107,10 @@ var createClient_tcp = function (port_arg, host_arg, options) {
exports.createClient = function(port_arg, host_arg, options) {
if (typeof port_arg === 'object' || port_arg === undefined) {
options = port_arg || options;
return createClient_tcp(default_port, default_host, options);
options = port_arg || options || {};
var host = options.host || default_host;
var port = +options.port || default_port;
return createClient_tcp(port, host, options);
}
if (typeof port_arg === 'number' || typeof port_arg === 'string' && /^\d+$/.test(port_arg)) {
return createClient_tcp(port_arg, host_arg, options);