diff --git a/assert/is-nonnegative-finite/coverage.ndjson b/assert/is-nonnegative-finite/coverage.ndjson new file mode 100644 index 000000000..faaa74b82 --- /dev/null +++ b/assert/is-nonnegative-finite/coverage.ndjson @@ -0,0 +1 @@ +[273,273,100,10,10,100,3,3,100,273,273,100,"50616dccd4e5fdda898315358bf5f1d91a254b22","2024-02-23 14:31:44 -0500"] diff --git a/assert/is-nonnegative-finite/index.html b/assert/is-nonnegative-finite/index.html new file mode 100644 index 000000000..f669a6408 --- /dev/null +++ b/assert/is-nonnegative-finite/index.html @@ -0,0 +1,161 @@ + + + + +
++ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
---|---|---|---|---|---|---|---|---|---|
index.js | +
+
+ |
+ 100% | +85/85 | +100% | +1/1 | +100% | +0/0 | +100% | +85/85 | +
main.js | +
+
+ |
+ 100% | +66/66 | +100% | +3/3 | +100% | +1/1 | +100% | +66/66 | +
object.js | +
+
+ |
+ 100% | +61/61 | +100% | +3/3 | +100% | +1/1 | +100% | +61/61 | +
primitive.js | +
+
+ |
+ 100% | +61/61 | +100% | +3/3 | +100% | +1/1 | +100% | +61/61 | +
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 | 1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x +1x + | /** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test if a value is a nonnegative finite number. +* +* @module @stdlib/assert/is-nonnegative-finite +* +* @example +* var isNonNegativeFinite = require( '@stdlib/assert/is-nonnegative-finite' ); +* +* var bool = isNonNegativeFinite( 5.0 ); +* // returns true +* +* bool = isNonNegativeFinite( new Number( 5.0 ) ); +* // returns true +* +* bool = isNonNegativeFinite( 3.14 ); +* // returns true +* +* var bool = isNonNegativeFinite( Infinity ); +* // returns false +* +* bool = isNonNegativeFinite( -5.0 ); +* // returns false +* +* bool = isNonNegativeFinite( null ); +* // returns false +* +* @example +* var isNonNegativeFinite = require( '@stdlib/assert/is-nonnegative-finite' ).isPrimitive; +* +* var bool = isNonNegativeFinite( 3.0 ); +* // returns true +* +* bool = isNonNegativeFinite( new Number( 3.0 ) ); +* // returns false +* +* @example +* var isNonNegativeFinite = require( '@stdlib/assert/is-nonnegative-finite' ).isObject; +* +* var bool = isNonNegativeFinite( 3.0 ); +* // returns false +* +* var bool = isNonNegativeFinite( Infinity ); +* // returns false +* +* bool = isNonNegativeFinite( new Number( 3.0 ) ); +* // returns true +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var isPrimitive = require( './primitive.js' ); +var isObject = require( './object.js' ); + + +// MAIN // + +setReadOnly( main, 'isPrimitive', isPrimitive ); +setReadOnly( main, 'isObject', isObject ); + + +// EXPORTS // + +module.exports = main; + |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 | 2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +2x +13x +13x +13x +2x +2x +2x +2x +2x + | /** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isPrimitive = require( './primitive.js' ); +var isObject = require( './object.js' ); + + +// MAIN // + +/** +* Tests if a value is a nonnegative finite number. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether value is a nonnegative number +* +* @example +* var bool = isNonNegativeFinite( 5.0 ); +* // returns true +* +* @example +* var bool = isNonNegativeFinite( new Number( 5.0 ) ); +* // returns true +* +* @example +* var bool = isNonNegativeFinite( 3.14 ); +* // returns true +* +* @example +* var bool = isNonNegativeFinite( Infinity ); +* // returns false +* +* @example +* var bool = isNonNegativeFinite( -5.0 ); +* // returns false +* +* @example +* var bool = isNonNegativeFinite( null ); +* // returns false +*/ +function isNonNegativeFinite( value ) { + return ( isPrimitive( value ) || isObject( value ) ); +} + + +// EXPORTS // + +module.exports = isNonNegativeFinite; + |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 | 3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +27x +27x +27x +2x +27x +27x +3x +3x +3x +3x +3x + | /** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number').isObject; +var isFinite = require( '@stdlib/assert/is-finite' ).isObject; // eslint-disable-line stdlib/no-redeclare + + +// MAIN // + +/** +* Tests if a value is a finite number object having a nonnegative value. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating if a value is a number object having a nonnegative finite number value +* +* @example +* var bool = isNonNegativeFinite( 3.0 ); +* // returns false +* +* @example +* var bool = isNonNegativeFinite( new Number( 3.0 ) ); +* // returns true +* +* @example +* var bool = isNonNegativeFinite( new Number( -5.0 ) ); +* // returns false +* +* @example +* var bool = isNonNegativeFinite( Infinity ); +* // returns false +*/ +function isNonNegativeFinite( value ) { + return ( + isNonNegativeNumber( value ) && + isFinite( value ) + ); +} + + +// EXPORTS // + +module.exports = isNonNegativeFinite; + |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 | 3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +3x +26x +26x +26x +4x +26x +26x +3x +3x +3x +3x +3x + | /** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive; +var isFinite = require( '@stdlib/assert/is-finite' ).isPrimitive; // eslint-disable-line stdlib/no-redeclare + + +// MAIN // + +/** +* Tests if a value is a number primitive having a nonnegative finite value. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative finite value +* +* @example +* var bool = isNonNegativeNumber( 3.0 ); +* // returns true +* +* @example +* var bool = isNonNegativeNumber( new Number( 3.0 ) ); +* // returns false +* +* @example +* var bool = isNonNegativeFinite( new Number( -5.0 ) ); +* // returns false +* +* @example +* var bool = isNonNegativeFinite( Infinity ); +* // returns false +*/ +function isNonNegativeFinite( value ) { + return ( + isNonNegativeNumber( value ) && + isFinite( value ) + ); +} + + +// EXPORTS // + +module.exports = isNonNegativeFinite; + |