From d79424e9c04fb409843c3a08b8f6eabc1036b7b6 Mon Sep 17 00:00:00 2001 From: Frankie Date: Fri, 21 Oct 2016 16:05:39 -0700 Subject: clean up the isHex function --- ui/app/util.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/app/util.js b/ui/app/util.js index a519ab5b4..72b3af465 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -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)/) } -- cgit