isPascalcase

Test if a value is a string in Pascal case.

Usage

var isPascalcase = require( '@stdlib/assert/is-pascalcase' );

isPascalcase( value )

Tests if a value is a string in Pascal case.

var bool = isPascalcase( 'HelloWorld' );
// returns true

bool = isPascalcase( 'Hello World' );
// returns false

Notes

  • The function validates that a value is a string. For all other types, the function returns false.

Examples

var isPascalcase = require( '@stdlib/assert/is-pascalcase' );

var bool = isPascalcase( 'FooBarBaz' );
// returns true

bool = isPascalcase( 'fooBarBaz' );
// returns false

bool = isPascalcase( 'Foo Bar Baz' );
// returns false

bool = isPascalcase( 'Beep-Boop' );
// returns false

bool = isPascalcase( null );
// returns false

CLI

Usage

Usage: is-pascalcase [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\nFooBar' | is-pascalcase --split /\r?\n/
    # Escaped...
    $ echo -n $'beEp booP\nFooBar' | is-pascalcase --split /\\r?\\n/
    
  • The implementation ignores trailing delimiters.

Examples

$ is-pascalcase Beep
true

To use as a standard stream,

$ echo -n 'boop' | is-pascalcase
false

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 'beep\tFooBar' | is-pascalcase --split '\t'
false
true
Did you find this page helpful?