Skip to content

Latest commit

 

History

History
149 lines (90 loc) · 2.54 KB

File metadata and controls

149 lines (90 loc) · 2.54 KB

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