Skip to content

Latest commit

 

History

History

is-integer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

isInteger

Test if a value is an integer.

Usage

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

isInteger( value )

Tests if a value is an integer.

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

Notes

  • If provided a non-numeric value, the function returns false.
    var bool = isInteger( '1' );
    // returns false

Examples

var isInteger = require( '@stdlib/utils/is-integer' );
var bool;

bool = isInteger( -5.0 );
// returns true

bool = isInteger( 0.0 );
// returns true

bool = isInteger( 5.256 );
// returns false

bool = isInteger( 1/0 );
// returns false

bool = isInteger( -1/0 );
// returns false