diff --git a/src/_assert.ts b/src/_assert.ts index e77e0f9..d892543 100644 --- a/src/_assert.ts +++ b/src/_assert.ts @@ -7,10 +7,7 @@ function bool(b: boolean) { } export function isBytes(a: unknown): a is Uint8Array { - return ( - a instanceof Uint8Array || - (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array') - ); + return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array'); } function bytes(b: Uint8Array | undefined, ...lengths: number[]) {