|
| 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 | +[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] --> |
| 24 | + |
| 25 | +> Test if a value is an array-like object of booleans. |
| 26 | +
|
| 27 | + |
| 28 | + |
| 29 | +<section class="usage"> |
| 30 | + |
| 31 | +## Usage |
| 32 | + |
| 33 | +To use in Observable, |
| 34 | + |
| 35 | +```javascript |
| 36 | +isBooleanArray = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-boolean-array@umd/bundle.js' ) |
| 37 | +``` |
| 38 | + |
| 39 | +To include the bundle in a webpage, |
| 40 | + |
| 41 | +```html |
| 42 | +<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-boolean-array@umd/bundle.js"></script> |
| 43 | +``` |
| 44 | + |
| 45 | +If no recognized module system is present, access bundle contents via the global scope: |
| 46 | + |
| 47 | +```html |
| 48 | +<script type="text/javascript"> |
| 49 | +(function () { |
| 50 | + window.isBooleanArray; |
| 51 | +})(); |
| 52 | +</script> |
| 53 | +``` |
| 54 | + |
| 55 | +#### isBooleanArray( value ) |
| 56 | + |
| 57 | +Tests if a `value` is an array-like object of `booleans`. |
| 58 | + |
| 59 | +```javascript |
| 60 | +var bool = isBooleanArray( [ true, false, false, true ] ); |
| 61 | +// returns true |
| 62 | +``` |
| 63 | + |
| 64 | +#### isBooleanArray.primitives( value ) |
| 65 | + |
| 66 | +Tests if a `value` is an array-like object containing **only** `boolean` primitives. |
| 67 | + |
| 68 | +<!-- eslint-disable no-new-wrappers --> |
| 69 | + |
| 70 | +```javascript |
| 71 | +var bool = isBooleanArray.primitives( [ true, false ] ); |
| 72 | +// returns true |
| 73 | + |
| 74 | +bool = isBooleanArray.primitives( [ false, new Boolean( true ) ] ); |
| 75 | +// returns false |
| 76 | +``` |
| 77 | + |
| 78 | +#### isBooleanArray.objects( value ) |
| 79 | + |
| 80 | +Tests if a `value` is an array-like object containing **only** `Boolean` objects. |
| 81 | + |
| 82 | +<!-- eslint-disable no-new-wrappers, max-len --> |
| 83 | + |
| 84 | +```javascript |
| 85 | +var bool = isBooleanArray.objects( [ new Boolean( false ), new Boolean( true ) ] ); |
| 86 | +// returns true |
| 87 | + |
| 88 | +bool = isBooleanArray.objects( [ new Boolean( false ), true ] ); |
| 89 | +// returns false |
| 90 | +``` |
| 91 | + |
| 92 | +</section> |
| 93 | + |
| 94 | +<!-- /.usage --> |
| 95 | + |
| 96 | +<section class="examples"> |
| 97 | + |
| 98 | +## Examples |
| 99 | + |
| 100 | +<!-- eslint-disable no-new-wrappers --> |
| 101 | + |
| 102 | +<!-- eslint no-undef: "error" --> |
| 103 | + |
| 104 | +```html |
| 105 | +<!DOCTYPE html> |
| 106 | +<html lang="en"> |
| 107 | +<body> |
| 108 | +<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-boolean-array@umd/bundle.js"></script> |
| 109 | +<script type="text/javascript"> |
| 110 | +(function () { |
| 111 | +
|
| 112 | +var bool = isBooleanArray( [ true, false ] ); |
| 113 | +// returns true |
| 114 | +
|
| 115 | +bool = isBooleanArray( [ true, new Boolean( false ) ] ); |
| 116 | +// returns true |
| 117 | +
|
| 118 | +bool = isBooleanArray( [ true, 'false' ] ); |
| 119 | +// returns false |
| 120 | +
|
| 121 | +bool = isBooleanArray( [] ); |
| 122 | +// returns false |
| 123 | +
|
| 124 | +bool = isBooleanArray( null ); |
| 125 | +// returns false |
| 126 | +
|
| 127 | +})(); |
| 128 | +</script> |
| 129 | +</body> |
| 130 | +</html> |
| 131 | +``` |
| 132 | + |
| 133 | +</section> |
| 134 | + |
| 135 | +<!-- /.examples --> |
| 136 | + |
| 137 | +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> |
| 138 | + |
| 139 | +<section class="related"> |
| 140 | + |
| 141 | +</section> |
| 142 | + |
| 143 | +<!-- /.related --> |
| 144 | + |
| 145 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 146 | + |
| 147 | + |
| 148 | +<section class="main-repo" > |
| 149 | + |
| 150 | +* * * |
| 151 | + |
| 152 | +## Notice |
| 153 | + |
| 154 | +This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. |
| 155 | + |
| 156 | +For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. |
| 157 | + |
| 158 | +#### Community |
| 159 | + |
| 160 | +[![Chat][chat-image]][chat-url] |
| 161 | + |
| 162 | +--- |
| 163 | + |
| 164 | +## License |
| 165 | + |
| 166 | +See [LICENSE][stdlib-license]. |
| 167 | + |
| 168 | + |
| 169 | +## Copyright |
| 170 | + |
| 171 | +Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. |
| 172 | + |
| 173 | +</section> |
| 174 | + |
| 175 | +<!-- /.stdlib --> |
| 176 | + |
| 177 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 178 | + |
| 179 | +<section class="links"> |
| 180 | + |
| 181 | +[npm-image]: http://img.shields.io/npm/v/@stdlib/assert-is-boolean-array.svg |
| 182 | +[npm-url]: https://npmjs.org/package/@stdlib/assert-is-boolean-array |
| 183 | + |
| 184 | +[test-image]: https://github.com/stdlib-js/assert-is-boolean-array/actions/workflows/test.yml/badge.svg?branch=main |
| 185 | +[test-url]: https://github.com/stdlib-js/assert-is-boolean-array/actions/workflows/test.yml?query=branch:main |
| 186 | + |
| 187 | +[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/assert-is-boolean-array/main.svg |
| 188 | +[coverage-url]: https://codecov.io/github/stdlib-js/assert-is-boolean-array?branch=main |
| 189 | + |
| 190 | +<!-- |
| 191 | +
|
| 192 | +[dependencies-image]: https://img.shields.io/david/stdlib-js/assert-is-boolean-array.svg |
| 193 | +[dependencies-url]: https://david-dm.org/stdlib-js/assert-is-boolean-array/main |
| 194 | +
|
| 195 | +--> |
| 196 | + |
| 197 | +[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg |
| 198 | +[chat-url]: https://gitter.im/stdlib-js/stdlib/ |
| 199 | + |
| 200 | +[stdlib]: https://github.com/stdlib-js/stdlib |
| 201 | + |
| 202 | +[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors |
| 203 | + |
| 204 | +[umd]: https://github.com/umdjs/umd |
| 205 | +[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules |
| 206 | + |
| 207 | +[deno-url]: https://github.com/stdlib-js/assert-is-boolean-array/tree/deno |
| 208 | +[umd-url]: https://github.com/stdlib-js/assert-is-boolean-array/tree/umd |
| 209 | +[esm-url]: https://github.com/stdlib-js/assert-is-boolean-array/tree/esm |
| 210 | + |
| 211 | +[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/assert-is-boolean-array/main/LICENSE |
| 212 | + |
| 213 | +</section> |
| 214 | + |
| 215 | +<!-- /.links --> |
0 commit comments