isInteger
Test if a value is a number having an integer value.
Installation
npm install @stdlib/assert-is-integer
Usage
var isInteger = require( '@stdlib/assert-is-integer' );
isInteger( value )
Tests if a value is a number
having an integer
value.
var Number = require( '@stdlib/number-ctor' );
var bool = isInteger( 5.0 );
bool = isInteger( new Number( 5.0 ) );
bool = isInteger( -3.14 );
bool = isInteger( null );
isInteger.isPrimitive( value )
Tests if a value
is a primitive number
having an integer
value.
var Number = require( '@stdlib/number-ctor' );
var bool = isInteger.isPrimitive( -3.0 );
bool = isInteger.isPrimitive( new Number( -3.0 ) );
isInteger.isObject( value )
Tests if a value
is a Number
object having an integer
value.
var Number = require( '@stdlib/number-ctor' );
var bool = isInteger.isObject( 3.0 );
bool = isInteger.isObject( new Number( 3.0 ) );
Examples
var Number = require( '@stdlib/number-ctor' );
var isInteger = require( '@stdlib/assert-is-integer' );
var bool = isInteger( -5.0 );
bool = isInteger( 0.0 );
bool = isInteger( new Number( 5.0 ) );
bool = isInteger( 5.256 );
bool = isInteger( 1.0/0.0 );
bool = isInteger( -1.0/0.0 );
bool = isInteger( '5' );
bool = isInteger( null );
Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
License
See LICENSE.
Copyright
Copyright © 2016-2021. The Stdlib Authors.
0.0.7 (2021-08-23)
No changes reported for this release.
</section>
<!-- /.release -->
<section class="release" id="v0.0.6">