@stdlib/assert-is-struct-constructor-like
v0.1.0
Published
Test if a value is struct constructor-like.
Readme
isStructConstructorLike
Test if a value is struct constructor-like.
Installation
npm install @stdlib/assert-is-struct-constructor-likeUsage
var isStructConstructorLike = require( '@stdlib/assert-is-struct-constructor-like' );isStructConstructorLike( value )
Tests if a value is struct constructor-like.
var structFactory = require( '@stdlib/dstructs-struct' );
var schema = [
{
'name': 'value',
'type': 'float64'
}
];
var Struct = structFactory( schema );
var bool = isStructConstructorLike( Struct );
// returns trueExamples
var structFactory = require( '@stdlib/dstructs-struct' );
var isStructConstructorLike = require( '@stdlib/assert-is-struct-constructor-like' );
var schema = [
{
'name': 'value',
'type': 'float64'
}
];
var bool = isStructConstructorLike( structFactory( schema ) );
// returns true
bool = isStructConstructorLike( [ 1, 2, 3, 4 ] );
// returns false
bool = isStructConstructorLike( {} );
// returns false
bool = isStructConstructorLike( null );
// returns falseSee Also
@stdlib/assert-is-struct: test if a value is astructinstance.@stdlib/dstructs-struct: fixed-width composite data type (a.k.a., astruct).
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.
