mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
clean up the isHex function
This commit is contained in:
parent
d4c0a4949b
commit
d79424e9c0
@ -212,7 +212,8 @@ function readableDate (ms) {
|
||||
}
|
||||
|
||||
function isHex (str) {
|
||||
if (str.startsWith('0x')) str = str.replace('0x', '')
|
||||
if (str.match(/[g-zG-Z]/) || str.match(/\W/)) return false
|
||||
return true
|
||||
if (str.startsWith('0x')) {
|
||||
return !str.substring(2).match(/([g-zG-Z]|\W)/)
|
||||
}
|
||||
return !str.match(/([g-zG-Z]|\W)/)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user