Network.isNetwork.
This commit is contained in:
parent
48f8edbe80
commit
052c18e091
@ -91,7 +91,6 @@ Address.prototype.toScript = function toScript() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Address.prototype.toString = function toString() {
|
Address.prototype.toString = function toString() {
|
||||||
assert(false, 'Cannot toString an address.');
|
|
||||||
return this.toBase58();
|
return this.toBase58();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -161,6 +161,19 @@ Network.prototype.inspect = function inspect() {
|
|||||||
return '<Network: ' + this.type + '>';
|
return '<Network: ' + this.type + '>';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test an object to see if it is a Network.
|
||||||
|
* @param {Object} obj
|
||||||
|
* @returns {Boolean}
|
||||||
|
*/
|
||||||
|
|
||||||
|
Network.isNetwork = function isNetwork(obj) {
|
||||||
|
return obj
|
||||||
|
&& typeof obj.getMinRelay === 'function'
|
||||||
|
&& typeof obj.genesisBlock === 'string'
|
||||||
|
&& typeof obj.pow === 'object';
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Expose
|
* Expose
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user