web3-utils
Advanced tools
Comparing version 1.0.0-beta.29 to 1.0.0-beta.30
{ | ||
"name": "web3-utils", | ||
"namespace": "ethereum", | ||
"version": "1.0.0-beta.29", | ||
"version": "1.0.0-beta.30", | ||
"description": "Collection of utility functions used in web3.js.", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-utils", |
@@ -259,6 +259,10 @@ /* | ||
var numberToHex = function (value) { | ||
if (!isFinite(value) && !_.isString(value)) { | ||
if (_.isNull(value) || _.isUndefined(value)) { | ||
return value; | ||
} | ||
if (!isFinite(value) && !isHexStrict(value)) { | ||
throw new Error('Given input "'+value+'" is not a number.'); | ||
} | ||
var number = toBN(value); | ||
@@ -373,3 +377,3 @@ var result = number.toString(16); | ||
var isHex = function (hex) { | ||
return ((_.isString(hex) || _.isNumber(hex)) && /^(-0x)?(0x)?[0-9a-f]*$/i.test(hex)); | ||
return ((_.isString(hex) || _.isNumber(hex)) && /^(-0x|0x)?[0-9a-f]*$/i.test(hex)); | ||
}; | ||
@@ -376,0 +380,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69466
2110