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

    0.0.5 • Public • Published

    isFiniteArray

    NPM version Build Status Coverage Status dependencies

    Test if a value is an array-like object containing only finite numbers.

    Installation

    npm install @stdlib/assert-is-finite-array

    Usage

    var isFiniteArray = require( '@stdlib/assert-is-finite-array' );

    isFiniteArray( value )

    Tests if a value is an array-like object containing only finite numbers.

    var Number = require( '@stdlib/number-ctor' );
    
    var bool = isFiniteArray( [ -3.0, new Number(3.0) ] );
    // returns true
    
    bool = isFiniteArray( [ -3.0, 'abc' ] );
    // returns false
    
    bool = isFiniteArray( [ -3.0, 1.0/0.0 ] );
    // returns false

    isFiniteArray.primitives( value )

    Tests if a value is an array-like object containing only primitive finite numbers.

    var Number = require( '@stdlib/number-ctor' );
    
    var bool = isFiniteArray.primitives( [ -1.0, 0.0, 4.5 ] );
    // returns true
    
    bool = isFiniteArray.primitives( [ -1.0, 1.0/0.0 ] );
    // returns false
    
    bool = isFiniteArray.primitives( [ -3.0, new Number(2.0) ] );
    // returns false

    isFiniteArray.objects( value )

    Tests if a value is an array-like object containing only Number objects having finite values.

    var Number = require( '@stdlib/number-ctor' );
    
    var bool = isFiniteArray.objects( [ new Number(-1.0), new Number(2.0) ] );
    // returns true
    
    bool = isFiniteArray.objects( [ -1.0, 0.0, 1.0 ] );
    // returns false
    
    bool = isFiniteArray.objects( [ -3.0, new Number(1.0) ] );
    // returns false

    Examples

    var Number = require( '@stdlib/number-ctor' );
    var isFiniteArray = require( '@stdlib/assert-is-finite-array' );
    
    var bool = isFiniteArray( [ -5.0, 0.0, 2.0, 5.0 ] );
    // returns true
    
    bool = isFiniteArray( [ -4.0, -3.14, 1.0, 3.14 ] );
    // returns true
    
    bool = isFiniteArray( [ -1.0, new Number( -6.0 ), 2.0 ] );
    // returns true
    
    bool = isFiniteArray( [ -1.0, 'abc', 3.0 ] );
    // returns false
    
    bool = isFiniteArray( [ -2.3, 1.0/0.0, 3.0 ] );
    // returns false
    
    bool = isFiniteArray( [] );
    // 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.

    Install

    npm i @stdlib/assert-is-finite-array

    DownloadsWeekly Downloads

    11

    Version

    0.0.5

    License

    Apache-2.0

    Unpacked Size

    40.6 kB

    Total Files

    9

    Homepage

    stdlib.io

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar