diff --git a/src/utils.test.ts b/src/utils.test.ts index af57280f..ed9dd8fe 100644 --- a/src/utils.test.ts +++ b/src/utils.test.ts @@ -124,6 +124,12 @@ describe('normalize', function () { expect(result).toBe('0x'); }); + it('should normalize an empty string to 0x', function () { + const initial = ''; + const result = normalize(initial); + expect(result).toBe('0x'); + }); + // TODO: Add validation to disallow null. it('should return undefined if given null', function () { const initial = null; diff --git a/src/utils.ts b/src/utils.ts index 87f41982..a60eab20 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -103,7 +103,7 @@ export function recoverPublicKey( * @returns The normalized value. */ export function normalize(input: number | string): string | undefined { - if (!input) { + if (isNullish(input)) { return undefined; }