Test if two arguments have the same type.
var isSameType = require( '@stdlib/assert/is-same-type' );
Tests if two arguments a
and b
have the same type.
var bool = isSameType( false, true );
// returns true
bool = isSameType( 'beep', 'boop' );
// returns true
bool = isSameType( 0.0, '0.0' );
// returns false
- The function uses the
typeof
operator to determine the type of each argument. - The function returns
true
if the types are the same andfalse
otherwise.
var isSameType = require( '@stdlib/assert/is-same-type' );
var bool = isSameType( true, false );
// returns true
bool = isSameType( 3.14, -3.14 );
// returns true
bool = isSameType( {}, [] );
// returns true
bool = isSameType( null, null );
// returns true
bool = isSameType( NaN, NaN );
// returns true
bool = isSameType( null, NaN );
// returns false
bool = isSameType( 0.0, '0.0' );
// returns false
@stdlib/assert/is-same-native-class
: test if two arguments have the same native class.@stdlib/assert/is-same-value
: test if two arguments are the same value.@stdlib/assert/is-strict-equal
: test if two arguments are strictly equal.