Package Exports
- @stdlib/assert-is-startcase
- @stdlib/assert-is-startcase/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@stdlib/assert-is-startcase) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
isStartcase
Test if a value is a startcase string.
Installation
npm install @stdlib/assert-is-startcaseUsage
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 falseNotes
- The function validates that a
valueis 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 falseCLI
Installation
To use the module as a general utility, install the module globally
npm install -g @stdlib/assert-is-startcaseUsage
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
splitoption 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
trueTo use as a standard stream,
$ echo -n 'Beep Boop' | is-startcase
trueBy 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