isStruct
Test if a value is a
structinstance.
Usage
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 true
Examples
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 false
See 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).