mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-23 11:38:12 +00:00
removed byte formatter methods
This commit is contained in:
parent
6fd17d99be
commit
d1e1206e5a
52
dist/web3-light.js
vendored
52
dist/web3-light.js
vendored
@ -1163,55 +1163,6 @@ var toAddress = function (address) {
|
|||||||
return '0x' + padLeft(toHex(address).substr(2), 40);
|
return '0x' + padLeft(toHex(address).substr(2), 40);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms given string to valid bytes-length string with 0x prefix
|
|
||||||
*
|
|
||||||
* @method toLeftPaddedBytes
|
|
||||||
* @param {String} string
|
|
||||||
* @return {String} formatted string
|
|
||||||
*/
|
|
||||||
var toLeftPaddedBytes = function (string, bytes) {
|
|
||||||
var reg = new RegExp('^[0-9a-f]{'+ bytes * 2 +'}$');
|
|
||||||
|
|
||||||
if (reg.test(string)) {
|
|
||||||
return '0x' + string;
|
|
||||||
}
|
|
||||||
|
|
||||||
return '0x' + padLeft(string.substr(2), bytes*2);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms given string to valid 8 bytes-length string with 0x prefix
|
|
||||||
*
|
|
||||||
* @method to8Bytes
|
|
||||||
* @param {String} string
|
|
||||||
* @return {String} formatted string
|
|
||||||
*/
|
|
||||||
var to8Bytes = function (string) {
|
|
||||||
return toLeftPaddedBytes(string, 8)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms given string to valid 32 bytes-length string with 0x prefix
|
|
||||||
*
|
|
||||||
* @method to32Bytes
|
|
||||||
* @param {String} string
|
|
||||||
* @return {String} formatted string
|
|
||||||
*/
|
|
||||||
var to32Bytes = function (string) {
|
|
||||||
return toLeftPaddedBytes(string, 32)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms given string to valid 64 bytes-length string with 0x prefix
|
|
||||||
*
|
|
||||||
* @method to64Bytes
|
|
||||||
* @param {String} string
|
|
||||||
* @return {String} formatted string
|
|
||||||
*/
|
|
||||||
var to64Bytes = function (string) {
|
|
||||||
return toLeftPaddedBytes(string, 64)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if object is BigNumber, otherwise false
|
* Returns true if object is BigNumber, otherwise false
|
||||||
@ -1311,9 +1262,6 @@ module.exports = {
|
|||||||
toBigNumber: toBigNumber,
|
toBigNumber: toBigNumber,
|
||||||
toTwosComplement: toTwosComplement,
|
toTwosComplement: toTwosComplement,
|
||||||
toAddress: toAddress,
|
toAddress: toAddress,
|
||||||
to8Bytes: to8Bytes,
|
|
||||||
to32Bytes: to32Bytes,
|
|
||||||
to64Bytes: to64Bytes,
|
|
||||||
isBigNumber: isBigNumber,
|
isBigNumber: isBigNumber,
|
||||||
isStrictAddress: isStrictAddress,
|
isStrictAddress: isStrictAddress,
|
||||||
isAddress: isAddress,
|
isAddress: isAddress,
|
||||||
|
4
dist/web3-light.js.map
vendored
4
dist/web3-light.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/web3-light.min.js
vendored
4
dist/web3-light.min.js
vendored
File diff suppressed because one or more lines are too long
52
dist/web3.js
vendored
52
dist/web3.js
vendored
@ -1163,55 +1163,6 @@ var toAddress = function (address) {
|
|||||||
return '0x' + padLeft(toHex(address).substr(2), 40);
|
return '0x' + padLeft(toHex(address).substr(2), 40);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms given string to valid bytes-length string with 0x prefix
|
|
||||||
*
|
|
||||||
* @method toLeftPaddedBytes
|
|
||||||
* @param {String} string
|
|
||||||
* @return {String} formatted string
|
|
||||||
*/
|
|
||||||
var toLeftPaddedBytes = function (string, bytes) {
|
|
||||||
var reg = new RegExp('^[0-9a-f]{'+ bytes * 2 +'}$');
|
|
||||||
|
|
||||||
if (reg.test(string)) {
|
|
||||||
return '0x' + string;
|
|
||||||
}
|
|
||||||
|
|
||||||
return '0x' + padLeft(string.substr(2), bytes*2);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms given string to valid 8 bytes-length string with 0x prefix
|
|
||||||
*
|
|
||||||
* @method to8Bytes
|
|
||||||
* @param {String} string
|
|
||||||
* @return {String} formatted string
|
|
||||||
*/
|
|
||||||
var to8Bytes = function (string) {
|
|
||||||
return toLeftPaddedBytes(string, 8)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms given string to valid 32 bytes-length string with 0x prefix
|
|
||||||
*
|
|
||||||
* @method to32Bytes
|
|
||||||
* @param {String} string
|
|
||||||
* @return {String} formatted string
|
|
||||||
*/
|
|
||||||
var to32Bytes = function (string) {
|
|
||||||
return toLeftPaddedBytes(string, 32)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms given string to valid 64 bytes-length string with 0x prefix
|
|
||||||
*
|
|
||||||
* @method to64Bytes
|
|
||||||
* @param {String} string
|
|
||||||
* @return {String} formatted string
|
|
||||||
*/
|
|
||||||
var to64Bytes = function (string) {
|
|
||||||
return toLeftPaddedBytes(string, 64)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if object is BigNumber, otherwise false
|
* Returns true if object is BigNumber, otherwise false
|
||||||
@ -1311,9 +1262,6 @@ module.exports = {
|
|||||||
toBigNumber: toBigNumber,
|
toBigNumber: toBigNumber,
|
||||||
toTwosComplement: toTwosComplement,
|
toTwosComplement: toTwosComplement,
|
||||||
toAddress: toAddress,
|
toAddress: toAddress,
|
||||||
to8Bytes: to8Bytes,
|
|
||||||
to32Bytes: to32Bytes,
|
|
||||||
to64Bytes: to64Bytes,
|
|
||||||
isBigNumber: isBigNumber,
|
isBigNumber: isBigNumber,
|
||||||
isStrictAddress: isStrictAddress,
|
isStrictAddress: isStrictAddress,
|
||||||
isAddress: isAddress,
|
isAddress: isAddress,
|
||||||
|
4
dist/web3.js.map
vendored
4
dist/web3.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/web3.min.js
vendored
4
dist/web3.min.js
vendored
File diff suppressed because one or more lines are too long
@ -363,55 +363,6 @@ var toAddress = function (address) {
|
|||||||
return '0x' + padLeft(toHex(address).substr(2), 40);
|
return '0x' + padLeft(toHex(address).substr(2), 40);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms given string to valid bytes-length string with 0x prefix
|
|
||||||
*
|
|
||||||
* @method toLeftPaddedBytes
|
|
||||||
* @param {String} string
|
|
||||||
* @return {String} formatted string
|
|
||||||
*/
|
|
||||||
var toLeftPaddedBytes = function (string, bytes) {
|
|
||||||
var reg = new RegExp('^[0-9a-f]{'+ bytes * 2 +'}$');
|
|
||||||
|
|
||||||
if (reg.test(string)) {
|
|
||||||
return '0x' + string;
|
|
||||||
}
|
|
||||||
|
|
||||||
return '0x' + padLeft(string.substr(2), bytes*2);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms given string to valid 8 bytes-length string with 0x prefix
|
|
||||||
*
|
|
||||||
* @method to8Bytes
|
|
||||||
* @param {String} string
|
|
||||||
* @return {String} formatted string
|
|
||||||
*/
|
|
||||||
var to8Bytes = function (string) {
|
|
||||||
return toLeftPaddedBytes(string, 8)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms given string to valid 32 bytes-length string with 0x prefix
|
|
||||||
*
|
|
||||||
* @method to32Bytes
|
|
||||||
* @param {String} string
|
|
||||||
* @return {String} formatted string
|
|
||||||
*/
|
|
||||||
var to32Bytes = function (string) {
|
|
||||||
return toLeftPaddedBytes(string, 32)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms given string to valid 64 bytes-length string with 0x prefix
|
|
||||||
*
|
|
||||||
* @method to64Bytes
|
|
||||||
* @param {String} string
|
|
||||||
* @return {String} formatted string
|
|
||||||
*/
|
|
||||||
var to64Bytes = function (string) {
|
|
||||||
return toLeftPaddedBytes(string, 64)
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if object is BigNumber, otherwise false
|
* Returns true if object is BigNumber, otherwise false
|
||||||
@ -511,9 +462,6 @@ module.exports = {
|
|||||||
toBigNumber: toBigNumber,
|
toBigNumber: toBigNumber,
|
||||||
toTwosComplement: toTwosComplement,
|
toTwosComplement: toTwosComplement,
|
||||||
toAddress: toAddress,
|
toAddress: toAddress,
|
||||||
to8Bytes: to8Bytes,
|
|
||||||
to32Bytes: to32Bytes,
|
|
||||||
to64Bytes: to64Bytes,
|
|
||||||
isBigNumber: isBigNumber,
|
isBigNumber: isBigNumber,
|
||||||
isStrictAddress: isStrictAddress,
|
isStrictAddress: isStrictAddress,
|
||||||
isAddress: isAddress,
|
isAddress: isAddress,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user