@arcblock/forge-util
Advanced tools
Comparing version 0.20.0 to 0.20.5
@@ -1,2 +0,5 @@ | ||
// most functions are from: https://github.com/ethereum/web3.js/blob/1.0/packages/web3-utils/src/Utils.js | ||
/** | ||
* @fileOverview Contains many utility functions to help developers manipulate encoding/decoding/formatting/bignumber | ||
* @module @arcblock/forge-util | ||
*/ | ||
const isBoolean = require('lodash/isBoolean'); | ||
@@ -16,2 +19,3 @@ const isString = require('lodash/isString'); | ||
* Returns a `Boolean` on whether or not the a `String` starts with '0x' | ||
* | ||
* @param {String} str the string input value | ||
@@ -31,2 +35,3 @@ * @return {Boolean} a boolean if it is or is not hex prefixed | ||
* Removes '0x' from a given `String` if present | ||
* | ||
* @param {String} str the string value | ||
@@ -47,5 +52,3 @@ * @return {String|Optional} a string by pass if necessary | ||
* @method isBN | ||
* | ||
* @param {Object} object | ||
* | ||
* @returns {Boolean} | ||
@@ -61,5 +64,3 @@ */ | ||
* @method isBigNumber | ||
* | ||
* @param {Object} object | ||
* | ||
* @returns {Boolean} | ||
@@ -75,5 +76,3 @@ */ | ||
* @method toBN | ||
* | ||
* @param {Number|String|BN} number, string, HEX string or BN | ||
* | ||
* @returns {BN} BN | ||
@@ -93,5 +92,3 @@ */ | ||
* @method utf8ToHex | ||
* | ||
* @param {String} str | ||
* | ||
* @returns {String} hex representation of input string | ||
@@ -132,5 +129,3 @@ */ | ||
* @method hexToUtf8 | ||
* | ||
* @param {String} hex | ||
* | ||
* @returns {String} ascii string representation of hex value | ||
@@ -173,5 +168,3 @@ */ | ||
* @method hexToNumber | ||
* | ||
* @param {String|Number|BN} value | ||
* | ||
* @returns {Number} | ||
@@ -191,5 +184,3 @@ */ | ||
* @method hexToNumberString | ||
* | ||
* @param {String|Number|BN} value | ||
* | ||
* @returns {String} | ||
@@ -207,5 +198,3 @@ */ | ||
* @method numberToHex | ||
* | ||
* @param {String|Number|BN} value | ||
* | ||
* @returns {String} | ||
@@ -234,5 +223,3 @@ */ | ||
* @method bytesToHex | ||
* | ||
* @param {Array} bytes | ||
* | ||
* @returns {String} the hex string | ||
@@ -257,5 +244,3 @@ */ | ||
* @method hexToBytes | ||
* | ||
* @param {String} hex | ||
* | ||
* @returns {Array} the byte array | ||
@@ -286,6 +271,4 @@ */ | ||
* @method toHex | ||
* | ||
* @param {String|Number|BN|Object|TypedArray|Buffer} value | ||
* @param {Boolean} returnType | ||
* | ||
* @returns {String} | ||
@@ -320,5 +303,3 @@ */ | ||
* @method isHexStrict | ||
* | ||
* @param {String} hex to be checked | ||
* | ||
* @returns {Boolean} | ||
@@ -334,5 +315,3 @@ */ | ||
* @method isHex | ||
* | ||
* @param {String} hex to be checked | ||
* | ||
* @returns {Boolean} | ||
@@ -367,2 +346,11 @@ */ | ||
/** | ||
* Format a big number to human readable number, such as 1_0000_0000_0000_000 => 1 Token | ||
* | ||
* @method fromUintToToken | ||
* @param {string|number} input | ||
* @param {number} [decimal=16] | ||
* @param {*} optionsInput | ||
* @returns {string} | ||
*/ | ||
const fromUnitToToken = (input, decimal = 16, optionsInput) => { | ||
@@ -401,2 +389,9 @@ let arc = numberToBN(input); | ||
/** | ||
* Convert human readable token number to big number instance | ||
* | ||
* @param {string} input | ||
* @param {number} [decimal=16] | ||
* @returns BN | ||
*/ | ||
const fromTokenToUnit = (input, decimal = 16) => { | ||
@@ -403,0 +398,0 @@ let ether = numberToString(input); |
{ | ||
"name": "@arcblock/forge-util", | ||
"version": "0.20.0", | ||
"version": "0.20.5", | ||
"description": "utils shared across mutlipe forge js libs, works in both node.js and browser", | ||
@@ -45,3 +45,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "1bcb6daa62e48486496c3e73518c23ba27489284" | ||
"gitHead": "b8526f942e8a04bcbeb47b0d6e1bd77570a29dd2" | ||
} |
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
14802
434