Test if a value is an array-like object containing only positive numbers.
npm install @stdlib/assert-is-positive-number-arrayvar isPositiveNumberArray = require( '@stdlib/assert-is-positive-number-array' );Tests if a value is an array-like object containing only positive numbers.
var Number = require( '@stdlib/number-ctor' ); var bool = isPositiveNumberArray( [ 3.0, new Number(3.0) ] ); // returns true bool = isPositiveNumberArray( [ 3.0, '3.0' ] ); // returns falseTests if a value is an array-like object array containing only primitive positive numbers.
var Number = require( '@stdlib/number-ctor' ); var bool = isPositiveNumberArray.primitives( [ 1.0, 5.0, 10.0 ] ); // returns true bool = isPositiveNumberArray.primitives( [ 3.0, new Number(1.0) ] ); // returns falseTests if a value is an array-like object array containing only object positive numbers.
var Number = require( '@stdlib/number-ctor' ); var bool = isPositiveNumberArray.objects( [ new Number(1.0), new Number(1.0) ] ); // returns true bool = isPositiveNumberArray.objects( [ 1.0, 5.0, 10.0 ] ); // returns falsevar Number = require( '@stdlib/number-ctor' ); var isPositiveNumberArray = require( '@stdlib/assert-is-positive-number-array' ); var bool = isPositiveNumberArray( [ 5.0, 0.2, 3.9 ] ); // returns true bool = isPositiveNumberArray( [ 1, 2, 3 ] ); // returns true bool = isPositiveNumberArray( [ 1, new Number( 6 ), 3 ] ); // returns true bool = isPositiveNumberArray( [ 0, 2, 4 ] ); // returns false bool = isPositiveNumberArray( [ 1, 'abc', 3 ] ); // returns false bool = isPositiveNumberArray( 78.0 ); // returns false@stdlib/assert/is-array: test if a value is an array.@stdlib/assert/is-number: test if a value is a number.@stdlib/assert/is-positive-number: test if a value is a number having a positive value.
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
See LICENSE.
Copyright © 2016-2021. The Stdlib Authors.