Skip to content

Commit

Permalink
$mol_compare_deep: fixed dataview support
Browse files Browse the repository at this point in the history
  • Loading branch information
jin committed Jan 8, 2024
1 parent 36892ed commit 5991863
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compare/deep/deep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ namespace $ {

function compare_buffer( left: ArrayBufferView, right: ArrayBufferView ): boolean {

const len = left.byteLength
if( len !== right.byteLength ) return false

if( left instanceof DataView ) return compare_buffer(
new Uint8Array( left.buffer, left.byteOffset, left.byteLength ),
new Uint8Array( right.buffer, left.byteOffset, left.byteLength ),
)

const len = left.byteLength
if( len !== right.byteLength ) return false

for( let i = 0; i < len; ++i ) {
if( (left as any)[i] !== (right as any)[i] ) return false
}
Expand Down

0 comments on commit 5991863

Please sign in to comment.