@stdlib/ndarray-base-assert-is-struct-data-type
v0.1.1
Published
Test if an input value is a supported ndarray struct data type.
Readme
isStructDataType
Test if an input value is a supported ndarray struct data type.
Installation
npm install @stdlib/ndarray-base-assert-is-struct-data-typeUsage
var isStructDataType = require( '@stdlib/ndarray-base-assert-is-struct-data-type' );isStructDataType( value )
Tests if an input value is a supported ndarray struct data type.
var structFactory = require( '@stdlib/dstructs-struct' );
var Struct = structFactory([
{
'name': 'foo',
'type': 'float64'
}
]);
var bool = isStructDataType( Struct );
// returns true
bool = isStructDataType( 'int32' );
// returns falseExamples
var structFactory = require( '@stdlib/dstructs-struct' );
var DataType = require( '@stdlib/ndarray-dtype-ctor' );
var isStructDataType = require( '@stdlib/ndarray-base-assert-is-struct-data-type' );
var Struct = structFactory([
{
'name': 'foo',
'type': 'float64'
}
]);
var bool = isStructDataType( Struct );
// returns true
bool = isStructDataType( new DataType( Struct ) );
// returns true
bool = isStructDataType( 'binary' );
// returns false
bool = isStructDataType( 'float32' );
// returns false
bool = isStructDataType( 'float64' );
// returns false
bool = isStructDataType( 'generic' );
// returns false
bool = isStructDataType( 'int16' );
// returns false
bool = isStructDataType( 'int32' );
// returns false
bool = isStructDataType( 'int8' );
// returns false
bool = isStructDataType( 'uint16' );
// returns false
bool = isStructDataType( 'uint32' );
// returns false
bool = isStructDataType( 'uint8' );
// returns false
bool = isStructDataType( 'uint8c' );
// returns false
bool = isStructDataType( '' );
// returns false
bool = isStructDataType( 'foo' );
// returns falseNotice
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.
