allow single object passed to bitcoin.Client()
This commit is contained in:
parent
9b657d67e6
commit
553e220182
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules
|
||||
@ -48,14 +48,16 @@ var bitcoinAPI = {
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Client
|
||||
// Either pass in 4 arguments, or a single object with host, port, user, pass
|
||||
//===----------------------------------------------------------------------===//
|
||||
function Client(host, port, user, pass) {
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.user = user;
|
||||
this.pass = pass;
|
||||
|
||||
this.rpc = new rpc.Client(port, host, user, pass);
|
||||
function Client() {
|
||||
var args = [].slice.call(arguments);
|
||||
this.host = args[0].host || args[0];
|
||||
this.port = args[0].port || args[1];
|
||||
this.user = args[0].user || args[2];
|
||||
this.pass = args[0].pass || args[3];
|
||||
|
||||
this.rpc = new rpc.Client(this.port, this.host, this.user, this.pass);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user