2.8 KiB
2.8 KiB
isPositiveNumberArray
Test if a value is an array-like object containing only positive numbers.
Usage
var isPositiveNumberArray = require( '@stdlib/assert/is-positive-number-array' );
isPositiveNumberArray( value )
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 false
isPositiveNumberArray.primitives( value )
Tests 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 false
isPositiveNumberArray.objects( value )
Tests 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 false
Examples
var 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