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