isNumberArray
Test if a value is an array-like object of numbers.
Installation
npm install @stdlib/assert-is-number-array
Usage
var isNumberArray = require( '@stdlib/assert-is-number-array' );
isNumberArray( value )
Tests if a value
is an array-like object of numbers
.
var bool = isNumberArray( [ 1, 2, 3, 4 ] );
isNumberArray.primitives( value )
Tests if a value
is an array-like object containing only number
primitives.
var Number = require( '@stdlib/number-ctor' );
var bool = isNumberArray.primitives( [ 1, 2, 3 ] );
bool = isNumberArray.primitives( [ 1, new Number( 2 ), 3 ] );
isNumberArray.objects( value )
Tests if a value
is an array-like object containing only Number
objects.
var Number = require( '@stdlib/number-ctor' );
var bool = isNumberArray.objects( [ new Number( 1 ), new Number( 2 ) ] );
bool = isNumberArray.objects( [ new Number( 1 ), 2 ] );
Examples
var Number = require( '@stdlib/number-ctor' );
var isNumberArray = require( '@stdlib/assert-is-number-array' );
var bool = isNumberArray( [ 3.14 ] );
bool = isNumberArray( [ NaN ] );
bool = isNumberArray( [ 1, 2, 3 ] );
bool = isNumberArray( [ new Number( 3.14 ), 2, 3 ] );
bool = isNumberArray( 3.14 );
bool = isNumberArray( [] );
bool = isNumberArray( [ '1', 2 ] );
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.
License
See LICENSE.
Copyright
Copyright © 2016-2021. The Stdlib Authors.
0.0.4 (2021-06-27)
No changes reported for this release.
</section>
<!-- /.release -->
<section class="release" id="v0.0.3">