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