isConstantcase
Test if a value is a constantcase string.
Usage
var isConstantcase = require( '@stdlib/assert/is-constantcase' );
isConstantcase( value )
Tests if a value
is a constantcase string
.
var bool = isConstantcase( 'BEEP_BOOP' );
// returns true
bool = isConstantcase( 'BEEP and BOOP' );
// returns false
Notes
- The function validates that a
value
is astring
. For all other types, the function returnsfalse
.
Examples
var isConstantcase = require( '@stdlib/assert/is-constantcase' );
console.log( isConstantcase( 'BEEP_BOOP' ) );
// => true
console.log( isConstantcase( 'BEEP and BOOP' ) );
// => false
console.log( isConstantcase( 'BEEP_BOOP_BEEP' ) );
// => true
console.log( isConstantcase( 'b' ) );
// => false
console.log( isConstantcase( 'B' ) );
// => true
console.log( isConstantcase( '!' ) );
// => false
console.log( isConstantcase( 'beep boop' ) );
// => false
CLI
Usage
Usage: is-constantcase [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-constantcase --split /\r?\n/ # Escaped... $ echo -n $'beEp booP\nFOO' | is-constantcase --split /\\r?\\n/
The implementation ignores trailing delimiters.
Examples
$ is-constantcase BEEP_BOOP
true
To use as a standard stream,
$ echo -n 'beep Boop' | is-constantcase
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 'beepBoop\tBEEP_BOOP' | is-constantcase --split '\t'
false
true