Non-Production Machines

    @stdlib/assert-is-positive-number
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.7 • Public • Published

    isPositiveNumber

    NPM version Build Status Coverage Status

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

    Installation

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

    Usage

    var isPositiveNumber = require( '@stdlib/assert-is-positive-number' );

    isPositiveNumber( value )

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

    var Number = require( '@stdlib/number-ctor' );
    
    var bool = isPositiveNumber( 5.0 );
    // returns true
    
    bool = isPositiveNumber( new Number( 5.0 ) );
    // returns true
    
    bool = isPositiveNumber( 3.14 );
    // returns true
    
    bool = isPositiveNumber( -5.0 );
    // returns false
    
    bool = isPositiveNumber( null );
    // returns false

    isPositiveNumber.isPrimitive( value )

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

    var Number = require( '@stdlib/number-ctor' );
    
    var bool = isPositiveNumber.isPrimitive( 3.0 );
    // returns true
    
    bool = isPositiveNumber.isPrimitive( new Number( 3.0 ) );
    // returns false

    isPositiveNumber.isObject( value )

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

    var Number = require( '@stdlib/number-ctor' );
    
    var bool = isPositiveNumber.isObject( 3.0 );
    // returns false
    
    bool = isPositiveNumber.isObject( new Number( 3.0 ) );
    // returns true

    Examples

    var Number = require( '@stdlib/number-ctor' );
    var isPositiveNumber = require( '@stdlib/assert-is-positive-number' );
    
    var bool = isPositiveNumber( 5.0 );
    // returns true
    
    bool = isPositiveNumber( new Number( 5.0 ) );
    // returns true
    
    bool = isPositiveNumber( 3.14 );
    // returns true
    
    bool = isPositiveNumber( 0.0 );
    // returns false
    
    bool = isPositiveNumber( -5.0 );
    // returns false
    
    bool = isPositiveNumber( '5' );
    // returns false
    
    bool = isPositiveNumber( null );
    // returns false

    See Also


    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-2022. The Stdlib Authors.

    Install

    npm i @stdlib/assert-is-positive-number

    Homepage

    stdlib.io

    DownloadsWeekly Downloads

    9,946

    Version

    0.0.7

    License

    Apache-2.0

    Unpacked Size

    44.1 kB

    Total Files

    11

    Last publish

    Collaborators

    • stdlib-bot
    • kgryte
    • planeshifter
    • rreusser