isCubeNumber

Test if a value is a cube number.

A cube number is defined as an integer value which is the cube of an integer.

Usage

var isCubeNumber = require( '@stdlib/assert/is-cube-number' );

isCubeNumber( value )

Tests if a value is a cube number.

var Number = require( '@stdlib/number/ctor' );

var bool = isCubeNumber( 8.0 );
// returns true

bool = isCubeNumber( new Number( 8.0 ) );
// returns true

bool = isCubeNumber( 3.14 );
// returns false

bool = isCubeNumber( -5.0 );
// returns false

bool = isCubeNumber( NaN );
// returns false

bool = isCubeNumber( null );
// returns false

isCubeNumber.isPrimitive( value )

Tests if a value is a primitive cube number.

var Number = require( '@stdlib/number/ctor' );

var bool = isCubeNumber.isPrimitive( 8.0 );
// returns true

bool = isCubeNumber.isPrimitive( new Number( 8.0 ) );
// returns false

isCubeNumber.isObject( value )

Tests if a value is a Number object having a value which is a cube number.

var Number = require( '@stdlib/number/ctor' );

var bool = isCubeNumber.isObject( 8.0 );
// returns false

bool = isCubeNumber.isObject( new Number( 8.0 ) );
// returns true

Examples

var Number = require( '@stdlib/number/ctor' );
var isCubeNumber = require( '@stdlib/assert/is-cube-number' );

var bool = isCubeNumber( 8.0 );
// returns true

bool = isCubeNumber( new Number( 8.0 ) );
// returns true

bool = isCubeNumber( 0.0 );
// returns true

bool = isCubeNumber( 1.0 );
// returns true

bool = isCubeNumber( 3.14 );
// returns false

bool = isCubeNumber( -5.0 );
// returns false

bool = isCubeNumber( NaN );
// returns false

bool = isCubeNumber( '0.5' );
// returns false

bool = isCubeNumber( null );
// returns false
Did you find this page helpful?