mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-21 20:55:48 +00:00
More robust input type handling for Uint160.from_json().
This commit is contained in:
@@ -263,9 +263,13 @@ UInt160.from_generic = function (j) {
|
|||||||
|
|
||||||
// Return a new UInt160 from j.
|
// Return a new UInt160 from j.
|
||||||
UInt160.from_json = function (j) {
|
UInt160.from_json = function (j) {
|
||||||
return 'string' === typeof j
|
if ('string' === typeof j) {
|
||||||
? (new UInt160()).parse_json(j)
|
return (new UInt160()).parse_json(j);
|
||||||
: j.clone();
|
} else if (j instanceof Uint160) {
|
||||||
|
return j.clone();
|
||||||
|
} else {
|
||||||
|
return new UInt160();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
UInt160.is_valid = function (j) {
|
UInt160.is_valid = function (j) {
|
||||||
|
|||||||
Reference in New Issue
Block a user