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