isSameAccessorArray
Test if two arguments are both accessor arrays and have the same values.
Usage
var isSameAccessorArray = require( '@stdlib/assert/is-same-accessor-array' );
isSameAccessorArray( v1, v2 )
Tests if two arguments are both accessor arrays and have the same values.
var Complex128Array = require( '@stdlib/array/complex128' );
var x = new Complex128Array( [ 1.0, 2.0 ] );
var y = new Complex128Array( [ 1.0, 2.0 ] );
var bool = isSameAccessorArray( x, y );
// returns true
bool = isSameAccessorArray( x, [ -1.0, 2.0 ] );
// returns false
Notes
- In contrast to the strict equality operator
===
, the function distinguishes between+0
and-0
and treatsNaNs
as the same value.
Examples
var isSameAccessorArray = require( '@stdlib/assert/is-same-accessor-array' );
var Complex128Array = require( '@stdlib/array/complex128' );
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] );
var y = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] );
var out = isSameAccessorArray( x, y );
// returns true
x = new Complex128Array( [ 1.0, 2.0, 0.0, 4.0 ] );
y = new Complex128Array( [ 1.0, 2.0, 3.0, -1.0 ] );
out = isSameAccessorArray( x, y );
// returns false
x = new Complex128Array( [ NaN, NaN ] );
y = new Complex128Array( [ NaN, NaN ] );
out = isSameAccessorArray( x, y );
// returns true