README.md (2177B)
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 # isBoolean 22 23 > Test if a value is a boolean. 24 25 <section class="usage"> 26 27 ### Usage 28 29 ```javascript 30 var isBoolean = require( '@stdlib/assert/is-boolean' ); 31 ``` 32 33 #### isBoolean( value ) 34 35 Tests if a `value` is a `boolean`. 36 37 <!-- eslint-disable no-new-wrappers --> 38 39 ```javascript 40 var bool = isBoolean( false ); 41 // returns true 42 43 bool = isBoolean( true ); 44 // returns true 45 46 bool = isBoolean( new Boolean( false ) ); 47 // returns true 48 49 bool = isBoolean( new Boolean( true ) ); 50 // returns true 51 ``` 52 53 #### isBoolean.isPrimitive( value ) 54 55 Tests if a `value` is a primitive `boolean`. 56 57 <!-- eslint-disable no-new-wrappers --> 58 59 ```javascript 60 var bool = isBoolean.isPrimitive( true ); 61 // returns true 62 63 bool = isBoolean.isPrimitive( false ); 64 // returns true 65 66 bool = isBoolean.isPrimitive( new Boolean( true ) ); 67 // returns false 68 ``` 69 70 #### isBoolean.isObject( value ) 71 72 Tests if a `value` is a `Boolean` object. 73 74 <!-- eslint-disable no-new-wrappers --> 75 76 ```javascript 77 var bool = isBoolean.isObject( true ); 78 // returns false 79 80 bool = isBoolean.isObject( new Boolean( false ) ); 81 // returns true 82 ``` 83 84 </section> 85 86 <!-- /.usage --> 87 88 <section class="examples"> 89 90 ### Examples 91 92 <!-- eslint-disable no-new-wrappers --> 93 94 <!-- eslint no-undef: "error" --> 95 96 ```javascript 97 var isBoolean = require( '@stdlib/assert/is-boolean' ); 98 99 var bool = isBoolean( false ); 100 // returns true 101 102 bool = isBoolean( new Boolean( false ) ); 103 // returns true 104 105 bool = isBoolean( 'true' ); 106 // returns false 107 108 bool = isBoolean( null ); 109 // returns false 110 ``` 111 112 </section> 113 114 <!-- /.examples --> 115 116 <section class="links"> 117 118 </section> 119 120 <!-- /.links -->