README.md (2150B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # isRegExpString 22 23 > Test if a value is a regular expression string. 24 25 <section class="intro"> 26 27 </section> 28 29 <!-- /.intro --> 30 31 <section class="usage"> 32 33 ## Usage 34 35 ```javascript 36 var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); 37 ``` 38 39 #### isRegExpString( value ) 40 41 Tests if a `value` is a regular expression `string`. 42 43 ```javascript 44 var bool = isRegExpString( '/^beep$/' ); 45 // returns true 46 ``` 47 48 </section> 49 50 <!-- /.usage --> 51 52 <section class="examples"> 53 54 ## Examples 55 56 <!-- eslint no-undef: "error" --> 57 58 ```javascript 59 var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); 60 61 var bool; 62 63 bool = isRegExpString( '/beep/' ); 64 // returns true 65 66 bool = isRegExpString( '/beep/gim' ); 67 // returns true 68 69 bool = isRegExpString( 'beep' ); 70 // returns false 71 72 bool = isRegExpString( '' ); 73 // returns false 74 75 bool = isRegExpString( null ); 76 // returns false 77 ``` 78 79 </section> 80 81 <!-- /.examples --> 82 83 * * * 84 85 <section class="cli"> 86 87 ## CLI 88 89 <section class="usage"> 90 91 ### Usage 92 93 ```text 94 Usage: is-regexp-string [options] [<string>] 95 96 Options: 97 98 -h, --help Print this message. 99 -V, --version Print the package version. 100 ``` 101 102 </section> 103 104 <!-- /.usage --> 105 106 <section class="examples"> 107 108 ### Examples 109 110 ```bash 111 $ is-regexp-string '/beep/' 112 true 113 ``` 114 115 To use as a [standard stream][standard-streams], 116 117 ```bash 118 $ echo -n '/beep/' | is-regexp-string 119 true 120 ``` 121 122 </section> 123 124 <!-- /.examples --> 125 126 </section> 127 128 <!-- /.cli --> 129 130 <section class="links"> 131 132 [standard-streams]: https://en.wikipedia.org/wiki/Standard_streams 133 134 </section> 135 136 <!-- /.links -->