Skip to content

Latest commit

 

History

History

is-blank-string

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

isBlankString

Test if a value is a blank string.

Usage

var isBlankString = require( '@stdlib/assert/is-blank-string' );

isBlankString( value )

Tests if a value is a blank string (i.e., an empty string or a string consisting only of whitespace characters).

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

bool = isBlankString( '' );
// returns true

bool = isBlankString( 0 );
// returns false

Examples

var isBlankString = require( '@stdlib/assert/is-blank-string' );

var out = isBlankString( '   ' );
// returns true

out = isBlankString( '\t\t\t' );
// returns true

out = isBlankString( '\r\n' );
// returns true

out = isBlankString( '' );
// returns true

out = isBlankString( 'beep boop' );
// returns false

out = isBlankString( null );
// returns false

CLI

Usage

Usage: is-blank-string [options] [<string>]

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.

Examples

$ is-blank-string baz
false

To use as a standard stream,

$ echo -n ' \t ' | is-blank-string
true