time-to-botec/squiggle/node_modules/@stdlib/assert/is-same-value-zero
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00
..
docs feat: add the node modules 2022-12-03 12:44:49 +00:00
lib feat: add the node modules 2022-12-03 12:44:49 +00:00
package.json feat: add the node modules 2022-12-03 12:44:49 +00:00
README.md feat: add the node modules 2022-12-03 12:44:49 +00:00

isSameValueZero

Test if two arguments are the same value.

Usage

var isSameValueZero = require( '@stdlib/assert/is-same-value-zero' );

isSameValueZero( a, b )

Tests if two arguments a and b are the same value.

var bool = isSameValueZero( false, false );
// returns true

bool = isSameValueZero( '', '' );
// returns true

bool = isSameValueZero( {}, {} );
// returns false

In contrast to the strict equality operator ===, the function treats NaNs as the same value.

var bool = ( NaN === NaN );
// returns false

bool = isSameValueZero( NaN, NaN );
// returns true

In contrast to the SameValue Algorithm, the function does not distinguish between +0 and -0.

var bool = ( 0.0 === -0.0 );
// returns true

bool = isSameValueZero( 0.0, -0.0 );
// returns true

bool = isSameValueZero( -0.0, 0.0 );
// returns true

Examples

var isSameValueZero = require( '@stdlib/assert/is-same-value-zero' );

var bool = isSameValueZero( true, true );
// returns true

bool = isSameValueZero( true, false );
// returns false

bool = isSameValueZero( 'beep', 'beep' );
// returns true

bool = isSameValueZero( 3.14, 3.14 );
// returns true

bool = isSameValueZero( null, null );
// returns true

bool = isSameValueZero( 0.0, 0.0 );
// returns true

bool = isSameValueZero( -0.0, 0.0 );
// returns true

bool = isSameValueZero( NaN, NaN );
// returns true

bool = isSameValueZero( {}, {} );
// returns false

bool = isSameValueZero( [], [] );
// returns false

bool = isSameValueZero( isSameValueZero, isSameValueZero );
// returns true