@stdlib/assert-is-nonpositive-number

Test if a value is a number having a nonpositive value.


Keywords
stdlib, stdassert, assertion, assert, utilities, utility, utils, util, number, numeric, nonpositive, is, isnumber, isnumeric, type, check, primitive, object, javascript, node, node-js, nodejs
License
Apache-2.0
Install
npm install @stdlib/assert-is-nonpositive-number@0.0.6

Documentation

isNonPositiveNumber

NPM version Build Status Coverage Status dependencies

Test if a value is a number having a nonpositive value.

Installation

npm install @stdlib/assert-is-nonpositive-number

Usage

var isNonPositiveNumber = require( '@stdlib/assert-is-nonpositive-number' );

isNonPositiveNumber( value )

Tests if a value is a number having a nonpositive value.

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

var bool = isNonPositiveNumber( -5.0 );
// returns true

bool = isNonPositiveNumber( new Number( -5.0 ) );
// returns true

bool = isNonPositiveNumber( -3.14 );
// returns true

bool = isNonPositiveNumber( 5.0 );
// returns false

bool = isNonPositiveNumber( null );
// returns false

isNonPositiveNumber.isPrimitive( value )

Tests if a value is a primitive number having a nonpositive value.

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

var bool = isNonPositiveNumber.isPrimitive( -3.0 );
// returns true

bool = isNonPositiveNumber.isPrimitive( new Number( -3.0 ) );
// returns false

isNonPositiveNumber.isObject( value )

Tests if a value is a Number object having a nonpositive value.

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

var bool = isNonPositiveNumber.isObject( -3.0 );
// returns false

bool = isNonPositiveNumber.isObject( new Number( -3.0 ) );
// returns true

Examples

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

var bool = isNonPositiveNumber( -5.0 );
// returns true

bool = isNonPositiveNumber( new Number( -5.0 ) );
// returns true

bool = isNonPositiveNumber( 0.0 );
// returns true

bool = isNonPositiveNumber( -3.14 );
// returns true

bool = isNonPositiveNumber( 5.0 );
// returns false

bool = isNonPositiveNumber( '-5' );
// returns false

bool = isNonPositiveNumber( null );
// returns false

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.

Community

Chat


License

See LICENSE.

Copyright

Copyright © 2016-2021. The Stdlib Authors.