@stdlib/assert-is-struct
v0.1.1
Published
Test if a value is a `struct` instance.
Readme
isStruct
Test if a value is a
structinstance.
Installation
npm install @stdlib/assert-is-structUsage
var isStruct = require( '@stdlib/assert-is-struct' );isStruct( value )
Tests if a value is a struct instance.
var structFactory = require( '@stdlib/dstructs-struct' );
var schema = [
{
'name': 'value',
'type': 'float64'
}
];
var Struct = structFactory( schema );
var bool = isStruct( new Struct() );
// returns trueExamples
var structFactory = require( '@stdlib/dstructs-struct' );
var isStruct = require( '@stdlib/assert-is-struct' );
var schema = [
{
'name': 'value',
'type': 'float64'
}
];
var Struct = structFactory( schema );
var bool = isStruct( new Struct() );
// returns true
bool = isStruct( [ 1, 2, 3, 4 ] );
// returns false
bool = isStruct( {} );
// returns false
bool = isStruct( null );
// returns falseSee Also
@stdlib/assert-is-struct-constructor-like: test if a value is struct constructor-like.@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.
