Skip to content

Files

is-pascalcase

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Oct 14, 2022
Oct 18, 2023
Feb 28, 2024
Oct 14, 2022
Oct 14, 2022
Oct 14, 2022
Jul 24, 2023
Oct 14, 2022
Oct 14, 2022

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