@stdlib/assert-is-undefined-or-null

Test if a value is undefined or null.

Usage no npm install needed!

<script type="module">
  import stdlibAssertIsUndefinedOrNull from 'https://cdn.skypack.dev/@stdlib/assert-is-undefined-or-null';
</script>

README

isUndefinedOrNull

NPM version Build Status Coverage Status dependencies

Test if a value is undefined or null.

Installation

npm install @stdlib/assert-is-undefined-or-null

Usage

var isUndefinedOrNull = require( '@stdlib/assert-is-undefined-or-null' );

isUndefinedOrNull( value )

Tests if a value is undefined or null.

var bool = isUndefinedOrNull( undefined );
// returns true

bool = isUndefinedOrNull( null );
// returns true

Examples

var isUndefinedOrNull = require( '@stdlib/assert-is-undefined-or-null' );

var bool;
var x;

bool = isUndefinedOrNull( x );
// returns true

bool = isUndefinedOrNull( undefined );
// returns true

bool = isUndefinedOrNull( void 0 );
// returns true

bool = isUndefinedOrNull( null );
// returns true

bool = isUndefinedOrNull( 'beep' );
// returns false

bool = isUndefinedOrNull( 5 );
// returns false

bool = isUndefinedOrNull( true );
// returns false

bool = isUndefinedOrNull( {} );
// returns false

bool = isUndefinedOrNull( [] );
// returns false

bool = isUndefinedOrNull( function foo() {} );
// returns false

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-2021. The Stdlib Authors.