README.md (2368B)
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 # isCapitalized 22 23 > Test if a value is a string having an uppercase first character. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var isCapitalized = require( '@stdlib/assert/is-capitalized' ); 31 ``` 32 33 #### isCapitalized( value ) 34 35 Tests if a `value` is a `string` having an uppercase first character. 36 37 ```javascript 38 var bool = isCapitalized( 'Every noble work is at first impossible.' ); 39 // returns true 40 41 bool = isCapitalized( 'HELLO WORLD!' ); 42 // returns true 43 44 bool = isCapitalized( 'salt and light' ); 45 // returns false 46 ``` 47 48 </section> 49 50 <!-- /.usage --> 51 52 <section class="notes"> 53 54 ## Notes 55 56 - The function validates that a `value` is a `string`. For all other types, the function returns `false`. 57 58 </section> 59 60 <!-- /.notes --> 61 62 <section class="examples"> 63 64 ## Examples 65 66 <!-- eslint no-undef: "error" --> 67 68 ```javascript 69 var isCapitalized = require( '@stdlib/assert/is-capitalized' ); 70 71 var bool = isCapitalized( 'Hello' ); 72 // returns true 73 74 bool = isCapitalized( 'HELLO' ); 75 // returns true 76 77 bool = isCapitalized( '' ); 78 // returns false 79 80 bool = isCapitalized( 'hello' ); 81 // returns false 82 ``` 83 84 </section> 85 86 <!-- /.examples --> 87 88 * * * 89 90 <section class="cli"> 91 92 ## CLI 93 94 <section class="usage"> 95 96 ### Usage 97 98 ```text 99 Usage: is-capitalized [options] [<string>] 100 101 Options: 102 103 -h, --help Print this message. 104 -V, --version Print the package version. 105 ``` 106 107 </section> 108 109 <!-- /.usage --> 110 111 <section class="examples"> 112 113 ### Examples 114 115 ```bash 116 $ is-capitalized Beep 117 true 118 ``` 119 120 </section> 121 122 To use as a [standard stream][standard-streams], 123 124 ```bash 125 $ echo -n 'boop' | is-capitalized 126 false 127 ``` 128 129 <!-- /.examples --> 130 131 </section> 132 133 <!-- /.cli --> 134 135 <section class="links"> 136 137 [standard-streams]: https://en.wikipedia.org/wiki/Standard_streams 138 139 </section> 140 141 <!-- /.links -->