File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55<section class =" release " id =" unreleased " >
66
7- ## Unreleased (2025-06-23 )
7+ ## Unreleased (2025-06-24 )
88
99<section class =" features " >
1010
1111### Features
1212
13+ - [ ` bf26784 ` ] ( https://github.com/stdlib-js/stdlib/commit/bf26784b458dee86137cc92cb269719cb6e0799e ) - add ` isStruct ` method
1314- [ ` cd45405 ` ] ( https://github.com/stdlib-js/stdlib/commit/cd4540545270de354c76083e571c587ac3c59a6e ) - add method to resolve a field type
1415- [ ` 4242b0c ` ] ( https://github.com/stdlib-js/stdlib/commit/4242b0cfa7df434d6b33ca306acfbb24d573cfa5 ) - add support for serializing a struct layout
1516- [ ` 13b4d50 ` ] ( https://github.com/stdlib-js/stdlib/commit/13b4d50284b4f5ba44c714add98ae8d04606cb86 ) - add initial implementation of ` dstructs/struct `
5657
5758<details >
5859
60+ - [ ` bf26784 ` ] ( https://github.com/stdlib-js/stdlib/commit/bf26784b458dee86137cc92cb269719cb6e0799e ) - ** feat:** add ` isStruct ` method _ (by Athan Reines)_
5961- [ ` 76ebd1b ` ] ( https://github.com/stdlib-js/stdlib/commit/76ebd1b06c85827a8166579c0a97c6bb20737e24 ) - ** refactor:** use assert utility _ (by Athan Reines)_
6062- [ ` 5aeb4ef ` ] ( https://github.com/stdlib-js/stdlib/commit/5aeb4ef105b90890e89ab138a55316c2d6546f71 ) - ** chore:** update package meta data [ (#7442 )] ( https://github.com/stdlib-js/stdlib/pull/7442 ) _ (by stdlib-bot)_
6163- [ ` 6d57645 ` ] ( https://github.com/stdlib-js/stdlib/commit/6d576457c3f4c7ed67481aaf6161d7c1c63874eb ) - ** docs:** fix descriptions _ (by Athan Reines)_
Original file line number Diff line number Diff line change 2424
2525var setReadOnly = require ( '@stdlib/utils/define-nonenumerable-read-only-property' ) ;
2626var setNonEnumerableReadOnlyAccessor = require ( '@stdlib/utils/define-nonenumerable-read-only-accessor' ) ;
27+ var isStructConstructorLike = require ( '@stdlib/assert/is-struct-constructor-like' ) ;
2728var isNonNegativeInteger = require ( '@stdlib/assert/is-nonnegative-integer' ) . isPrimitive ;
2829var isCollection = require ( '@stdlib/assert/is-collection' ) ;
2930var isArrayBuffer = require ( '@stdlib/assert/is-arraybuffer' ) ;
@@ -422,6 +423,27 @@ function factory( fields ) {
422423 return obj [ PRIVATE_BUFFER ] . buffer ;
423424 } ) ;
424425
426+ /**
427+ * Returns a boolean indicating whether a provided value is a `struct` instance.
428+ *
429+ * @private
430+ * @name isStruct
431+ * @memberof Struct
432+ * @readonly
433+ * @type {Function }
434+ * @param {* } value - input value
435+ * @returns {boolean } boolean indicating whether a value is a `struct` instance
436+ */
437+ setReadOnly ( Struct , 'isStruct' , function isStruct ( value ) {
438+ return (
439+ value instanceof Struct ||
440+ (
441+ isStructInstance ( value ) &&
442+ isStructConstructorLike ( value . constructor )
443+ )
444+ ) ;
445+ } ) ;
446+
425447 /**
426448 * Returns the underlying byte buffer of a `struct` as a `DataView`.
427449 *
You can’t perform that action at this time.
0 commit comments