time-to-botec/js/node_modules/@stdlib/assert/is-odd/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.4 KiB

isOdd

Test if a value is an odd number.

Usage

var isOdd = require( '@stdlib/assert/is-odd' );

isOdd( value )

Tests if a value is an odd number.

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

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

bool = isOdd( new Number( 5.0 ) );
// returns true

bool = isOdd( 6.0 );
// returns false

bool = isOdd( -3.14 );
// returns false

bool = isOdd( null );
// returns false

bool = isOdd( NaN );
// returns false

isOdd.isPrimitive( value )

Tests if a value is an odd primitive number.

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

var bool = isOdd.isPrimitive( -5.0 );
// returns true

bool = isOdd.isPrimitive( new Number( -5.0 ) );
// returns false

isOdd.isObject( value )

Tests if a value is a Number object having an odd number value.

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

var bool = isOdd.isObject( 5.0 );
// returns false

bool = isOdd.isObject( new Number( 5.0 ) );
// returns true

Examples

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

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

bool = isOdd( new Number( 5 ) );
// returns true

bool = isOdd( 0.0 );
// returns false

bool = isOdd( 4.0 );
// returns false

bool = isOdd( NaN );
// returns false

bool = isOdd( '5' );
// returns false

bool = isOdd( null );
// returns false