JSPM

@stdlib/assert-is-startcase

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q26853F
  • License Apache-2.0

Test if a value is a startcase string.

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

NPM version Build Status Coverage Status

Test if a value is a startcase string.

Installation

npm install @stdlib/assert-is-startcase

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 a string. For all other types, the function returns false.

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

Installation

To use the module as a general utility, install the module globally

npm install -g @stdlib/assert-is-startcase

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