Skip to content

Latest commit

 

History

History

is-negative-integer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

isNegativeInteger

Test if a value is a number having a negative integer value.

Usage

var isNegativeInteger = require( '@stdlib/utils/is-negative-integer' );

isNegativeInteger( value )

Tests if a value is a number having a negative integer value.

var bool = isNegativeInteger( -5.0 );
// returns true

bool = isNegativeInteger( new Number( -5.0 ) );
// returns true

bool = isNegativeInteger( 5.0 );
// returns false

bool = isNegativeInteger( -3.14 );
// returns false

bool = isNegativeInteger( null );
// returns false

isNegativeInteger.isPrimitive( value )

Tests if a value is a primitive number having a negative integer value.

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

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

isNegativeInteger.isObject( value )

Tests if a value is a Number object having a negative integer value.

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

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

isNegativeInteger.isNegativeIntegerArray( value )

Tests if a value is a number array having only negative integer values.

var bool = isNegativeInteger.isNegativeIntegerArray( [ -3.0, new Number(-3.0) ] );
// returns true

bool = isNegativeInteger.isNegativeIntegerArray( [ -3.0, '-3.0' ] );
// returns false

isNegativeInteger.isNegativePrimitiveIntegerArray( value )

Tests if a value is a primitive number array having only negative integer values.

var bool = isNegativeInteger.isNegativePrimitiveIntegerArray( [ -1.0, -2.0, -10.0 ] );
// returns true

bool = isNegativeInteger.isNegativePrimitiveIntegerArray( [ -3.0, new Number(-1.0) ] );
// returns false

Examples

var isNegativeInteger = require( '@stdlib/utils/is-negative-integer' );

console.log( isNegativeInteger( -5.0 ) );
// returns true

console.log( isNegativeInteger( new Number( -5.0 ) ) );
// returns true

console.log( isNegativeInteger( 0.0 ) );
// returns false

console.log( isNegativeInteger( -3.14 ) );
// returns false

console.log( isNegativeInteger( 5.0 ) );
// returns false

console.log( isNegativeInteger( '-5' ) );
// returns false

console.log( isNegativeInteger( null ) );
// returns false