Skip to content

Commit

Permalink
Correct regex
Browse files Browse the repository at this point in the history
  • Loading branch information
spacesailor24 committed Nov 11, 2020
1 parent 1694692 commit 5fbd65c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/web3-utils/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ var isHex = function (hex) {
* @returns {String}
*/
var stripHexPrefix = function (str) {
if (isHex(str))
return str.replace(/^(?:\-)0x/i, '')
if (str !== 0 && isHex(str))
return str.replace(/^(-)?0x/i, '$1')
return str;
};

Expand Down

0 comments on commit 5fbd65c

Please sign in to comment.