2.7 KiB
2.7 KiB
isNonPositiveNumber
Test if a value is a number having a nonpositive value.
Usage
var isNonPositiveNumber = require( '@stdlib/assert/is-nonpositive-number' );
isNonPositiveNumber( value )
Tests if a value
is a number
having a nonpositive value.
var Number = require( '@stdlib/number/ctor' );
var bool = isNonPositiveNumber( -5.0 );
// returns true
bool = isNonPositiveNumber( new Number( -5.0 ) );
// returns true
bool = isNonPositiveNumber( -3.14 );
// returns true
bool = isNonPositiveNumber( 5.0 );
// returns false
bool = isNonPositiveNumber( null );
// returns false
isNonPositiveNumber.isPrimitive( value )
Tests if a value
is a primitive number
having a nonpositive value.
var Number = require( '@stdlib/number/ctor' );
var bool = isNonPositiveNumber.isPrimitive( -3.0 );
// returns true
bool = isNonPositiveNumber.isPrimitive( new Number( -3.0 ) );
// returns false
isNonPositiveNumber.isObject( value )
Tests if a value
is a Number
object having a nonpositive value.
var Number = require( '@stdlib/number/ctor' );
var bool = isNonPositiveNumber.isObject( -3.0 );
// returns false
bool = isNonPositiveNumber.isObject( new Number( -3.0 ) );
// returns true
Examples
var Number = require( '@stdlib/number/ctor' );
var isNonPositiveNumber = require( '@stdlib/assert/is-nonpositive-number' );
var bool = isNonPositiveNumber( -5.0 );
// returns true
bool = isNonPositiveNumber( new Number( -5.0 ) );
// returns true
bool = isNonPositiveNumber( 0.0 );
// returns true
bool = isNonPositiveNumber( -3.14 );
// returns true
bool = isNonPositiveNumber( 5.0 );
// returns false
bool = isNonPositiveNumber( '-5' );
// returns false
bool = isNonPositiveNumber( null );
// returns false