Skip to content

Commit

Permalink
fix: buffer to hex
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcr committed Oct 26, 2023
1 parent 21fc1b2 commit 66a2784
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/helpers/values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ export function parseBoolean(val: string | undefined | null): boolean {
* is zero length.
*/
export function bufferToHex(buff: Buffer, prefix: boolean = true): string {
if (buff.length === 0) {
return '';
}
return prefix ? '0x' : '' + buff.toString('hex');
return buff.length === 0 ? '' : (prefix ? '0x' : '') + buff.toString('hex');
}

/**
Expand Down

0 comments on commit 66a2784

Please sign in to comment.