@stdlib/assert-is-regexp-string
v0.2.2
Published
Test if a value is a regular expression string.
Downloads
1,365,379
Readme
isRegExpString
Test if a value is a regular expression string.
Installation
npm install @stdlib/assert-is-regexp-string
Usage
var isRegExpString = require( '@stdlib/assert-is-regexp-string' );
isRegExpString( value )
Tests if a value
is a regular expression string
.
var bool = isRegExpString( '/^beep$/' );
// returns true
Examples
var isRegExpString = require( '@stdlib/assert-is-regexp-string' );
var bool;
bool = isRegExpString( '/beep/' );
// returns true
bool = isRegExpString( '/beep/gim' );
// returns true
bool = isRegExpString( 'beep' );
// returns false
bool = isRegExpString( '' );
// returns false
bool = isRegExpString( null );
// returns false
See Also
@stdlib/assert-is-regexp-string-cli
: CLI package for use as a command-line utility.@stdlib/assert-is-regexp
: test if a value is a regular expression.
Notice
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-2024. The Stdlib Authors.