fix: edge case constructing from string '0' (#121)

* fix: edge case constructing from string '0'
This commit is contained in:
Nathan Nichols
2021-03-10 11:36:01 -06:00
parent 9bd9ebfc09
commit 53c72b7045
2 changed files with 35 additions and 0 deletions

View File

@@ -54,6 +54,10 @@ class UInt64 extends UInt {
}
if (typeof val === "string") {
if (val === "0") {
return UInt64.from(0);
}
if (!HEX_REGEX.test(val)) {
throw new Error(`${val} is not a valid hex-string`);
}