isPositiveNumber

Test if a value is a number having a positive value.

Usage

var isPositiveNumber = require( '@stdlib/assert/is-positive-number' );

isPositiveNumber( value )

Tests if a value is a number having a positive value.

var Number = require( '@stdlib/number/ctor' );

var bool = isPositiveNumber( 5.0 );
// returns true

bool = isPositiveNumber( new Number( 5.0 ) );
// returns true

bool = isPositiveNumber( 3.14 );
// returns true

bool = isPositiveNumber( -5.0 );
// returns false

bool = isPositiveNumber( null );
// returns false

isPositiveNumber.isPrimitive( value )

Tests if a value is a primitive number having a positive value.

var Number = require( '@stdlib/number/ctor' );

var bool = isPositiveNumber.isPrimitive( 3.0 );
// returns true

bool = isPositiveNumber.isPrimitive( new Number( 3.0 ) );
// returns false

isPositiveNumber.isObject( value )

Tests if a value is a Number object having a positive value.

var Number = require( '@stdlib/number/ctor' );

var bool = isPositiveNumber.isObject( 3.0 );
// returns false

bool = isPositiveNumber.isObject( new Number( 3.0 ) );
// returns true

Examples

var Number = require( '@stdlib/number/ctor' );
var isPositiveNumber = require( '@stdlib/assert/is-positive-number' );

var bool = isPositiveNumber( 5.0 );
// returns true

bool = isPositiveNumber( new Number( 5.0 ) );
// returns true

bool = isPositiveNumber( 3.14 );
// returns true

bool = isPositiveNumber( 0.0 );
// returns false

bool = isPositiveNumber( -5.0 );
// returns false

bool = isPositiveNumber( '5' );
// returns false

bool = isPositiveNumber( null );
// returns false
Did you find this page helpful?