Files
Superalgos/Client/node_modules/strip-hex-prefix/src/index.js
T
2020-11-20 20:28:04 +01:00

15 lines
359 B
JavaScript

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;
}