isStartcase
Test if a value is a startcase string.
Usage
var isStartcase = require( '@stdlib/assert/is-startcase' );
isStartcase( value )
Tests if a value
is a startcase string
(i.e., the first character of each word is uppercase).
var bool = isStartcase( 'Beep Boop' );
// returns true
bool = isStartcase( 'Beep and Boop' );
// returns false
Notes
- The function validates that a
value
is astring
. For all other types, the function returnsfalse
.
Examples
var isStartcase = require( '@stdlib/assert/is-startcase' );
var bool = isStartcase( 'Beep Boop' );
// returns true
bool = isStartcase( 'BeepBoop123' );
// returns true
bool = isStartcase( 'beep Boop' );
// returns false
bool = isStartcase( 'beep' );
// returns false
bool = isStartcase( 'beepBoop' );
// returns false
bool = isStartcase( null );
// returns false
CLI
Usage
Usage: is-startcase [options] [<string>]
Options:
-h, --help Print this message.
-V, --version Print the package version.
--split sep Delimiter for stdin data. Default: '/\\r?\\n/'.
Notes
If the split separator is a regular expression, ensure that the
split
option is either properly escaped or enclosed in quotes.# Not escaped... $ echo -n $'BeEp BooP\nFOO' | is-startcase --split /\r?\n/ # Escaped... $ echo -n $'BeEp BooP\nFOO' | is-startcase --split /\\r?\\n/
The implementation ignores trailing delimiters.
Examples
$ is-startcase BeepBoop
true
To use as a standard stream,
$ echo -n 'Beep Boop' | is-startcase
true
By default, when used as a standard stream, the implementation assumes newline-delimited data. To specify an alternative delimiter, set the split
option.
$ echo -n 'beepBoop\tBEEP_BOOP' | is-startcase --split '\t'
false
true