time-to-botec/squiggle/node_modules/@stdlib/assert/is-square-number/README.md
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

2.8 KiB

isSquareNumber

Test if a value is a square number.

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

Usage

var isSquareNumber = require( '@stdlib/assert/is-square-number' );

isSquareNumber( value )

Tests if a value is a square number.

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

var bool = isSquareNumber( 4.0 );
// returns true

bool = isSquareNumber( new Number( 4.0 ) );
// returns true

bool = isSquareNumber( 3.14 );
// returns false

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

bool = isSquareNumber( NaN );
// returns false

bool = isSquareNumber( null );
// returns false

isSquareNumber.isPrimitive( value )

Tests if a value is a primitive square number.

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

var bool = isSquareNumber.isPrimitive( 4.0 );
// returns true

bool = isSquareNumber.isPrimitive( new Number( 4.0 ) );
// returns false

isSquareNumber.isObject( value )

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

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

var bool = isSquareNumber.isObject( 4.0 );
// returns false

bool = isSquareNumber.isObject( new Number( 4.0 ) );
// returns true

Examples

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

var bool = isSquareNumber( 4.0 );
// returns true

bool = isSquareNumber( new Number( 4.0 ) );
// returns true

bool = isSquareNumber( 0.0 );
// returns true

bool = isSquareNumber( 1.0 );
// returns true

bool = isSquareNumber( 3.14 );
// returns false

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

bool = isSquareNumber( NaN );
// returns false

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

bool = isSquareNumber( null );
// returns false