Socket
Socket
Sign inDemoInstall

@arcblock/forge-util

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arcblock/forge-util - npm Package Compare versions

Comparing version 0.12.2 to 0.12.3

29

lib/index.js

@@ -15,2 +15,29 @@ // most functions are from: https://github.com/ethereum/web3.js/blob/1.0/packages/web3-utils/src/Utils.js

/**
* Returns a `Boolean` on whether or not the a `String` starts with '0x'
* @param {String} str the string input value
* @return {Boolean} a boolean if it is or is not hex prefixed
* @throws if the str input is not a string
*/
const isHexPrefixed = str => {
if (typeof str !== 'string') {
throw new Error('[is-hex-prefixed] value must be type string');
}
return str.slice(0, 2).toLowerCase() === '0x';
};
/**
* Removes '0x' from a given `String` if present
* @param {String} str the string value
* @return {String|Optional} a string by pass if necessary
*/
const stripHexPrefix = str => {
if (typeof str !== 'string') {
return str;
}
return isHexPrefixed(str) ? str.slice(2) : str;
};
/**
* Returns true if object is BN, otherwise false

@@ -411,2 +438,4 @@ *

isBigNumber,
isHexPrefixed,
stripHexPrefix,
utf8ToHex,

@@ -413,0 +442,0 @@ hexToUtf8,

4

package.json
{
"name": "@arcblock/forge-util",
"version": "0.12.2",
"version": "0.12.3",
"description": "utils shared across mutlipe forge js libs, works in both node.js and browser",

@@ -45,3 +45,3 @@ "keywords": [

},
"gitHead": "56a2e548c7abc10ce76a96c259b7a6b2cd11148e"
"gitHead": "750553ccecfb063e55f5a62d721b6c3553678bcf"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc