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