From 9db14fc6d072172dab348a73b06108df7895eb67 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Sun, 10 Dec 2023 22:26:57 +0000 Subject: [PATCH] utils: fix-up isBytes --- src/abstract/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/abstract/utils.ts b/src/abstract/utils.ts index 9b340d6..7aec03a 100644 --- a/src/abstract/utils.ts +++ b/src/abstract/utils.ts @@ -16,7 +16,7 @@ export type CHash = { }; export type FHash = (message: Uint8Array | string) => Uint8Array; -function isBytes(a: any): a is Uint8Array { +export function isBytes(a: any): a is Uint8Array { return a instanceof Uint8Array || a.constructor.name === 'Uint8Array'; } @@ -271,7 +271,7 @@ const validatorFns = { function: (val: any) => typeof val === 'function', boolean: (val: any) => typeof val === 'boolean', string: (val: any) => typeof val === 'string', - stringOrUint8Array: (val: any) => typeof val === 'string' || val instanceof Uint8Array, + stringOrUint8Array: (val: any) => typeof val === 'string' || isBytes(val), isSafeInteger: (val: any) => Number.isSafeInteger(val), array: (val: any) => Array.isArray(val), field: (val: any, object: any) => (object as any).Fp.isValid(val),