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