mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 08:32:39 +03:00
link fe: make uxToHex more safe
Matching implementation from contacts' lib/util.js.
This commit is contained in:
parent
33f7d62186
commit
a675e5442b
@ -128,9 +128,10 @@ export function deSig(ship) {
|
||||
return ship.replace('~', '');
|
||||
}
|
||||
|
||||
//TODO look at uxToHex wonky functionality
|
||||
//TODO what does "wonky functionality" refer to?
|
||||
export function uxToHex(ux) {
|
||||
let value = ux.substr(2).replace('.', '').padStart(6, '0');
|
||||
return value;
|
||||
if (ux.length > 2 && ux.substr(0,2) === '0x') {
|
||||
return ux.substr(2).replace('.', '').padStart(6, '0');
|
||||
} else {
|
||||
return ux.replace('.', '').padStart(6, '0');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user