@stdlib/assert-is-empty-string

Test if a value is an empty string.

Usage no npm install needed!

<script type="module">
  import stdlibAssertIsEmptyString from 'https://cdn.skypack.dev/@stdlib/assert-is-empty-string';
</script>

README

isEmptyString

NPM version Build Status Coverage Status

Test if a value is an empty string.

Installation

npm install @stdlib/assert-is-empty-string

Usage

var isEmptyString = require( '@stdlib/assert-is-empty-string' );

isEmptyString( value )

Tests if a value is an empty string.

var bool = isEmptyString( '' );
// returns true

bool = isEmptyString( new String( '' ) );
// returns true

isEmptyString.isPrimitive( value )

Tests if a value is an empty primitive string.

var bool = isEmptyString.isPrimitive( '' );
// returns true

bool = isEmptyString.isPrimitive( new String( '' ) );
// returns false

isEmptyString.isObject( value )

Tests if a value is an empty String object.

var bool = isEmptyString.isObject( '' );
// returns false

bool = isEmptyString.isObject( new String( '' ) );
// returns true

Examples

var isEmptyString = require( '@stdlib/assert-is-empty-string' );

var bool = isEmptyString( '' );
// returns true

bool = isEmptyString( new String( '' ) );
// returns true

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

bool = isEmptyString( 0 );
// returns false

bool = isEmptyString( null );
// returns false

bool = isEmptyString( void 0 );
// returns false

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

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

bool = isEmptyString( function empty() {} );
// 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-2022. The Stdlib Authors.