@stdlib/assert-is-empty-string
v0.2.2
Published
Test if a value is an empty string.
Downloads
48
Readme
isEmptyString
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
See Also
@stdlib/assert-is-string
: test if a value is a string.
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
License
See LICENSE.
Copyright
Copyright © 2016-2024. The Stdlib Authors.