@ethersproject/bytes
Advanced tools
Comparing version 5.1.0 to 5.2.0
@@ -1,2 +0,2 @@ | ||
export declare const version = "bytes/5.1.0"; | ||
export declare const version = "bytes/5.2.0"; | ||
//# sourceMappingURL=_version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export const version = "bytes/5.1.0"; | ||
export const version = "bytes/5.2.0"; | ||
//# sourceMappingURL=_version.js.map |
@@ -31,7 +31,7 @@ export declare type Bytes = ArrayLike<number>; | ||
export declare function isHexString(value: any, length?: number): boolean; | ||
export declare function hexlify(value: BytesLike | Hexable | number, options?: DataOptions): string; | ||
export declare function hexlify(value: BytesLike | Hexable | number | bigint, options?: DataOptions): string; | ||
export declare function hexDataLength(data: BytesLike): number; | ||
export declare function hexDataSlice(data: BytesLike, offset: number, endOffset?: number): string; | ||
export declare function hexConcat(items: ReadonlyArray<BytesLike>): string; | ||
export declare function hexValue(value: BytesLike | Hexable | number): string; | ||
export declare function hexValue(value: BytesLike | Hexable | number | bigint): string; | ||
export declare function hexStripZeros(value: BytesLike): string; | ||
@@ -38,0 +38,0 @@ export declare function hexZeroPad(value: BytesLike, length: number): string; |
@@ -142,3 +142,3 @@ "use strict"; | ||
while (value) { | ||
hex = HexCharacters[value & 0x0f] + hex; | ||
hex = HexCharacters[value & 0xf] + hex; | ||
value = Math.floor(value / 16); | ||
@@ -154,2 +154,9 @@ } | ||
} | ||
if (typeof (value) === "bigint") { | ||
value = value.toString(16); | ||
if (value.length % 2) { | ||
return ("0x0" + value); | ||
} | ||
return "0x" + value; | ||
} | ||
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") { | ||
@@ -156,0 +163,0 @@ value = "0x" + value; |
@@ -1,2 +0,2 @@ | ||
export declare const version = "bytes/5.1.0"; | ||
export declare const version = "bytes/5.2.0"; | ||
//# sourceMappingURL=_version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = "bytes/5.1.0"; | ||
exports.version = "bytes/5.2.0"; | ||
//# sourceMappingURL=_version.js.map |
@@ -31,7 +31,7 @@ export declare type Bytes = ArrayLike<number>; | ||
export declare function isHexString(value: any, length?: number): boolean; | ||
export declare function hexlify(value: BytesLike | Hexable | number, options?: DataOptions): string; | ||
export declare function hexlify(value: BytesLike | Hexable | number | bigint, options?: DataOptions): string; | ||
export declare function hexDataLength(data: BytesLike): number; | ||
export declare function hexDataSlice(data: BytesLike, offset: number, endOffset?: number): string; | ||
export declare function hexConcat(items: ReadonlyArray<BytesLike>): string; | ||
export declare function hexValue(value: BytesLike | Hexable | number): string; | ||
export declare function hexValue(value: BytesLike | Hexable | number | bigint): string; | ||
export declare function hexStripZeros(value: BytesLike): string; | ||
@@ -38,0 +38,0 @@ export declare function hexZeroPad(value: BytesLike, length: number): string; |
@@ -151,3 +151,3 @@ "use strict"; | ||
while (value) { | ||
hex = HexCharacters[value & 0x0f] + hex; | ||
hex = HexCharacters[value & 0xf] + hex; | ||
value = Math.floor(value / 16); | ||
@@ -163,2 +163,9 @@ } | ||
} | ||
if (typeof (value) === "bigint") { | ||
value = value.toString(16); | ||
if (value.length % 2) { | ||
return ("0x0" + value); | ||
} | ||
return "0x" + value; | ||
} | ||
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") { | ||
@@ -165,0 +172,0 @@ value = "0x" + value; |
{ | ||
"author": "Richard Moore <me@ricmoo.com>", | ||
"dependencies": { | ||
"@ethersproject/logger": "^5.1.0" | ||
"@ethersproject/logger": "^5.2.0" | ||
}, | ||
@@ -18,3 +18,3 @@ "description": "Bytes utility functions for ethers.", | ||
], | ||
"gitHead": "3b1d3fcee6bfb5178861e26ff1a1e9daa0663ec9", | ||
"gitHead": "dad3829c2e54b1c002c83ce948dc172530f6846d", | ||
"keywords": [ | ||
@@ -42,5 +42,5 @@ "Ethereum", | ||
"sideEffects": false, | ||
"tarballHash": "0xbf3f9d896c02b5f7ab44c4ecd7b6c6590ed68367714ac7cc0f4b89dfffccf479", | ||
"tarballHash": "0xf5c9822d7ad93e85a836d07774c105a2c8a70c1e6e111b1dcaf49d6e00bd375d", | ||
"types": "./lib/index.d.ts", | ||
"version": "5.1.0" | ||
"version": "5.2.0" | ||
} |
@@ -1,1 +0,1 @@ | ||
export const version = "bytes/5.1.0"; | ||
export const version = "bytes/5.2.0"; |
@@ -193,3 +193,3 @@ "use strict"; | ||
export function hexlify(value: BytesLike | Hexable | number, options?: DataOptions): string { | ||
export function hexlify(value: BytesLike | Hexable | number | bigint, options?: DataOptions): string { | ||
if (!options) { options = { }; } | ||
@@ -202,3 +202,3 @@ | ||
while (value) { | ||
hex = HexCharacters[value & 0x0f] + hex; | ||
hex = HexCharacters[value & 0xf] + hex; | ||
value = Math.floor(value / 16); | ||
@@ -215,2 +215,8 @@ } | ||
if (typeof(value) === "bigint") { | ||
value = value.toString(16); | ||
if (value.length % 2) { return ("0x0" + value); } | ||
return "0x" + value; | ||
} | ||
if (options.allowMissingPrefix && typeof(value) === "string" && value.substring(0, 2) !== "0x") { | ||
@@ -289,3 +295,3 @@ value = "0x" + value; | ||
export function hexValue(value: BytesLike | Hexable | number): string { | ||
export function hexValue(value: BytesLike | Hexable | number | bigint): string { | ||
const trimmed = hexStripZeros(hexlify(value, { hexPad: "left" })); | ||
@@ -292,0 +298,0 @@ if (trimmed === "0x") { return "0x0"; } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
76953
1246
Updated@ethersproject/logger@^5.2.0