README.md (2019B)
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 # isWhitespace 22 23 > Test whether a string contains only [white space][whitespace] characters. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var isWhitespace = require( '@stdlib/assert/is-whitespace' ); 31 ``` 32 33 #### isWhitespace( value ) 34 35 Tests whether a string contains only [white space][whitespace] characters. 36 37 ```javascript 38 var bool = isWhitespace( ' ' ); 39 // returns true 40 ``` 41 42 </section> 43 44 <!-- /.usage --> 45 46 <section class="notes"> 47 48 ## Notes 49 50 - A [white space][whitespace] character is defined as one of the 25 characters defined as a [white space][whitespace] ("WSpace=Y","WS") character in the Unicode 9.0 character database, as well as one related [white space][whitespace] character without the Unicode character property "WSpace=Y" (zero width non-breaking space which was deprecated as of Unicode 3.2). 51 - For non-string values, the function returns `false`. 52 53 </section> 54 55 <!-- /.notes --> 56 57 <section class="examples"> 58 59 ## Examples 60 61 <!-- eslint no-undef: "error" --> 62 63 ```javascript 64 var isWhitespace = require( '@stdlib/assert/is-whitespace' ); 65 66 var out = isWhitespace( ' ' ); 67 // returns true 68 69 out = isWhitespace( '' ); 70 // returns false 71 72 out = isWhitespace( '\\r\\n' ); 73 // returns false 74 75 out = isWhitespace( 123 ); 76 // returns false 77 ``` 78 79 </section> 80 81 <!-- /.examples --> 82 83 <section class="links"> 84 85 [whitespace]: https://en.wikipedia.org/wiki/Whitespace_character 86 87 </section> 88 89 <!-- /.links -->