isndarrayLikeWithDataType

Test if a value is an ndarray-like object having a specified data type.

Usage

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 true

Examples

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 false
Did you find this page helpful?