@stdlib/assert-is-ndarray-like-with-data-type
v0.1.1
Published
Test if a value is an ndarray-like object having a specified data type.
Readme
isndarrayLikeWithDataType
Test if a value is an ndarray-like object having a specified data type.
Installation
npm install @stdlib/assert-is-ndarray-like-with-data-typeUsage
var isndarrayLikeWithDataType = require( '@stdlib/assert-is-ndarray-like-with-data-type' );isndarrayLikeWithDataType( value, dtype )
Tests if a value is an ndarray-like object having a specified data type.
var ndarray = require( '@stdlib/ndarray-ctor' );
var arr = ndarray( 'generic', [ 0, 0, 0, 0 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
var bool = isndarrayLikeWithDataType( arr, 'generic' );
// returns trueExamples
var ndarray = require( '@stdlib/ndarray-ctor' );
var isndarrayLikeWithDataType = require( '@stdlib/assert-is-ndarray-like-with-data-type' );
var arr = ndarray( 'generic', [ 0, 0, 0, 0 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
var bool = isndarrayLikeWithDataType( arr, 'generic' );
// returns true
bool = isndarrayLikeWithDataType( [ 1, 2, 3, 4 ], 'generic' );
// returns false
bool = isndarrayLikeWithDataType( {}, 'generic' );
// returns false
bool = isndarrayLikeWithDataType( null, 'generic' );
// returns falseSee Also
@stdlib/assert-is-ndarray-like: test if a value is ndarray-like.
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
License
See LICENSE.
Copyright
Copyright © 2016-2026. The Stdlib Authors.
