UNPKG

check-ethereum-scanner

Version:

Safety checks for new Ethereum tokens

15 lines (12 loc) 359 B
var isHexPrefixed = require('is-hex-prefixed'); /** * Removes '0x' from a given `String` is present * @param {String} str the string value * @return {String|Optional} a string by pass if necessary */ module.exports = function stripHexPrefix(str) { if (typeof str !== 'string') { return str; } return isHexPrefixed(str) ? str.slice(2) : str; }