8000 GitHub - stdlib-js/assert-is-strict-equal at e01233d40afabc788ed0eb8eee5c1c0abca0985f
[go: up one dir, main page]

Skip to content

stdlib-js/assert-is-strict-equal

Repository files navigation

isStrictEqual

NPM version Build Status Coverage Status

Test if two arguments are strictly equal.

Installation

npm install @stdlib/assert-is-strict-equal

Alternatively,

The branches.md file summarizes the available branches and displays a diagram illustrating their relationships.

Usage

var isStrictEqual = require( '@stdlib/assert-is-strict-equal' );

isStrictEqual( a, b )

Tests if two arguments a and b are strictly equal.

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

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

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

bool = isStrictEqual( NaN, NaN );
// returns false

In contrast to the strict equality operator ===, the function distinguishes between +0 and -0.

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

bool = isStrictEqual( 0.0, -0.0 );
// returns false

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

Examples

var isStrictEqual = require( '@stdlib/assert-is-strict-equal' );

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

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

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

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

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

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

bool = isStrictEqual( -0.0, 0.0 );
// returns false

bool = isStrictEqual( NaN, NaN );
// returns false

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

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

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

See Also


Notice

This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.

For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.

Community

Chat


License

See LICENSE.

Copyright

Copyright © 2016-2023. The Stdlib Authors.

0