Package Exports
- @stdlib/assert-is-snakecase
- @stdlib/assert-is-snakecase/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-snakecase) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
isSnakecase
Test if a value is a string in snake case.
Installation
npm install @stdlib/assert-is-snakecaseUsage
var isSnakecase = require( '@stdlib/assert-is-snakecase' );isSnakecase( value )
Tests if a value is a string in snake case.
var bool = isSnakecase( 'hello_world' );
// returns true
bool = isSnakecase( 'Hello World' );
// returns falseNotes
- The function validates that a
valueis astring. For all other types, the function returnsfalse.
Examples
var isSnakecase = require( '@stdlib/assert-is-snakecase' );
var bool = isSnakecase( 'foo_bar_baz' );
// returns true
bool = isSnakecase( 'FOO_BAR' );
// returns false
bool = isSnakecase( 'fooBar' );
// returns false
bool = isSnakecase( 'beep-boop' );
// returns false
bool = isSnakecase( null );
// returns falseCLI
Installation
To use the module as a general utility, install the module globally
npm install -g @stdlib/assert-is-snakecaseUsage
Usage: is-snakecase [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_bar' | is-snakecase --split /\r?\n/ # Escaped... $ echo -n $'beEp booP\nfoo_bar' | is-snakecase --split /\\r?\\n/
The implementation ignores trailing delimiters.
Examples
$ is-snakecase foo_bar
trueTo use as a standard stream,
$ echo -n 'fooBar' | is-snakecase
falseBy default, when used as a standard stream, the implementation assumes newline-delimited data. To specify an alternative delimiter, set the split option.
$ echo -n 'fooBar\tbeep_boop' | is-snakecase --split '\t'
false
trueNotice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2022. The Stdlib Authors.