Use toBuffer to prevent allocation

This commit is contained in:
dapplion 2020-11-25 17:57:33 +00:00
parent e32ea6d7a5
commit 4ca6532171
1 changed files with 1 additions and 1 deletions

View File

@ -13,7 +13,7 @@ export function bytesToHex(bytes: Uint8Array): string {
}
export function isEqualBytes(a: Buffer | Uint8Array, b: Buffer | Uint8Array): boolean {
return Buffer.from(a).equals(Buffer.from(b));
return toBuffer(a).equals(toBuffer(b));
}
export function toBuffer(input: Uint8Array): Buffer {