isNumber
Test if a value is a number.
Usage
var isNumber = require( '@stdlib/assert/is-number' );
isNumber( value )
Tests if a value
is a number
.
var Number = require( '@stdlib/number/ctor' );
var bool = isNumber( 3.14 );
// returns true
bool = isNumber( new Number( 3.14 ) );
// returns true
bool = isNumber( NaN );
// returns true
bool = isNumber( null );
// returns false
isNumber.isPrimitive( value )
Tests if a value
is a primitive number
.
var Number = require( '@stdlib/number/ctor' );
var bool = isNumber.isPrimitive( 3.14 );
// returns true
bool = isNumber.isPrimitive( NaN );
// returns true
bool = isNumber.isPrimitive( new Number( 3.14 ) );
// returns false
isNumber.isObject( value )
Tests if a value
is a Number
object.
var Number = require( '@stdlib/number/ctor' );
var bool = isNumber.isObject( 3.14 );
// returns false
bool = isNumber.isObject( new Number( 3.14 ) );
// returns true
Examples
var Number = require( '@stdlib/number/ctor' );
var isNumber = require( '@stdlib/assert/is-number' );
var bool = isNumber( 5 );
// returns true
bool = isNumber( new Number( 5 ) );
// returns true
bool = isNumber( NaN );
// returns true
bool = isNumber( '5' );
// returns false
bool = isNumber( null );
// returns false