|
| 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 | +# isPositiveFinite |
| 22 | + |
| 23 | +> Test if a value is a number having a non infinite positive value. |
| 24 | +
|
| 25 | +<section class="usage"> |
| 26 | + |
| 27 | +## Usage |
| 28 | + |
| 29 | +```javascript |
| 30 | +var isPositiveFinite = require( '@stdlib/assert/is-positive-finite' ); |
| 31 | +``` |
| 32 | + |
| 33 | +#### isPositiveFinite( value ) |
| 34 | + |
| 35 | +Tests if a `value` is a `number` having a non infinite positive value. |
| 36 | + |
| 37 | +<!-- eslint-disable no-new-wrappers --> |
| 38 | + |
| 39 | +```javascript |
| 40 | +var Number = require( '@stdlib/number/ctor' ); |
| 41 | + |
| 42 | +var bool = isPositiveFinite( 5.0 ); |
| 43 | +// returns true |
| 44 | + |
| 45 | +bool = isPositiveFinite( new Number( 5.0 ) ); |
| 46 | +// returns true |
| 47 | + |
| 48 | +bool = isPositiveFinite( 5.0/0.0 ); |
| 49 | +// returns false |
| 50 | + |
| 51 | +bool = isPositiveFinite( -5.0 ); |
| 52 | +// returns false |
| 53 | + |
| 54 | +bool = isPositiveFinite( new Number( 5.0/0.0 ) ); |
| 55 | +// returns false |
| 56 | + |
| 57 | +bool = isPositiveFinite( null ); |
| 58 | +// returns false |
| 59 | +``` |
| 60 | + |
| 61 | +#### isPositiveFinite.isPrimitive( value ) |
| 62 | + |
| 63 | +Tests if a `value` is a primitive `number` having a non-infinite positive value. |
| 64 | + |
| 65 | +<!-- eslint-disable no-new-wrappers --> |
| 66 | + |
| 67 | +```javascript |
| 68 | +var Number = require( '@stdlib/number/ctor' ); |
| 69 | + |
| 70 | +var bool = isPositiveFinite.isPrimitive( 3.0 ); |
| 71 | +// returns true |
| 72 | + |
| 73 | +bool = isPositiveFinite.isPrimitive( 3.0/0.0 ); |
| 74 | +// returns false |
| 75 | + |
| 76 | +bool = isPositiveFinite.isPrimitive( new Number( 3.0 ) ); |
| 77 | +// returns false |
| 78 | +``` |
| 79 | + |
| 80 | +#### isPositiveFinite.isObject( value ) |
| 81 | + |
| 82 | +Tests if a `value` is a `Number` object having a non-infinite positive value. |
| 83 | + |
| 84 | +<!-- eslint-disable no-new-wrappers --> |
| 85 | + |
| 86 | +```javascript |
| 87 | +var Number = require( '@stdlib/number/ctor' ); |
| 88 | + |
| 89 | +var bool = isPositiveFinite.isObject( new Number( 3.0 ) ); |
| 90 | +// returns true |
| 91 | + |
| 92 | +bool = isPositiveFinite.isObject( 3.0 ); |
| 93 | +// returns false |
| 94 | + |
| 95 | +bool = isPositiveFinite.isObject( new Number( 3.0/0.0 ) ); |
| 96 | +// returns false |
| 97 | +``` |
| 98 | + |
| 99 | +</section> |
| 100 | + |
| 101 | +<!-- /.usage --> |
| 102 | + |
| 103 | +<section class="examples"> |
| 104 | + |
| 105 | +## Examples |
| 106 | + |
| 107 | +<!-- eslint-disable no-new-wrappers --> |
| 108 | + |
| 109 | +<!-- eslint no-undef: "error" --> |
| 110 | + |
| 111 | +```javascript |
| 112 | +var Number = require( '@stdlib/number/ctor' ); |
| 113 | +var isPositiveFinite = require( '@stdlib/assert/is-positive-finite' ); |
| 114 | + |
| 115 | +var bool = isPositiveFinite( 5.0 ); |
| 116 | +// returns true |
| 117 | + |
| 118 | +bool = isPositiveFinite( new Number( 5.0 ) ); |
| 119 | +// returns true |
| 120 | + |
| 121 | +bool = isPositiveFinite( 3.14 ); |
| 122 | +// returns true |
| 123 | + |
| 124 | +bool = isPositiveFinite( 0.0 ); |
| 125 | +// returns false |
| 126 | + |
| 127 | +bool = isPositiveFinite( 1.0/0.0 ); |
| 128 | +// returns false |
| 129 | + |
| 130 | +bool = isPositiveFinite( new Number( 5.0/0.0 ) ); |
| 131 | +// returns false |
| 132 | + |
| 133 | +bool = isPositiveFinite( -5.0 ); |
| 134 | +// returns false |
| 135 | + |
| 136 | +bool = isPositiveFinite( '5' ); |
| 137 | +// returns false |
| 138 | + |
| 139 | +bool = isPositiveFinite( null ); |
| 140 | +// returns false |
| 141 | +``` |
| 142 | + |
| 143 | +</section> |
| 144 | + |
| 145 | +<!-- /.examples --> |
| 146 | + |
| 147 | +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> |
| 148 | + |
| 149 | +<section class="related"> |
| 150 | + |
| 151 | +* * * |
| 152 | + |
| 153 | +## See Also |
| 154 | + |
| 155 | +- <span class="package-name">[`@stdlib/assert/is-number`][@stdlib/assert/is-number]</span><span class="delimiter">: </span><span class="description">test if a value is a number.</span> |
| 156 | + |
| 157 | +</section> |
| 158 | + |
| 159 | +<!-- /.related --> |
| 160 | + |
| 161 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 162 | + |
| 163 | +<section class="links"> |
| 164 | + |
| 165 | +<!-- <related-links> --> |
| 166 | + |
| 167 | +[@stdlib/assert/is-number]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/is-number |
| 168 | + |
| 169 | +<!-- </related-links> --> |
| 170 | + |
| 171 | +</section> |
| 172 | + |
| 173 | +<!-- /.links --> |
0 commit comments