The `is-data-descriptor` package is a focused utility designed to accurately determine if a given JavaScript value conforms to the characteristics of a valid data property descriptor, as defined by the ECMAScript specification. Currently stable at version 2.1.3, it is part of the `inspect-js` family of descriptor validation libraries. Unlike `is-descriptor`, which checks for any valid descriptor type, this package specifically targets data descriptors, verifying the presence and correct types of properties like `value`, `writable`, `enumerable`, and `configurable`, while ensuring the absence of accessor properties (`get`, `set`). Its release cadence is typically slow, reflecting its stable and specific functionality. A key characteristic is that it will not throw an error for extraneous, invalid properties present on the descriptor object, which might differ from strict validation expectations in some scenarios. It is primarily used in Node.js environments and build processes where strict object property definition validation is required.
npm install is-data-descriptorVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `is-data-descriptor` to check various objects for valid data descriptor characteristics, including both valid and invalid examples.
Ensure descriptor objects contain *only* valid data descriptor properties. If you need to validate any type of descriptor (data or accessor), consider using `is-descriptor` instead.
Always include `value` or `writable` in your data descriptor objects, even if their values are `undefined` or `false`, respectively.
For CommonJS: `const isDataDescriptor = require('is-data-descriptor');`. For ESM: `import isDataDescriptor from 'is-data-descriptor';`.Use the ESM import syntax: `import isDataDescriptor from 'is-data-descriptor';`.
No dependency data recorded yet.