The `is-accessor-descriptor` package provides a focused utility function to determine if a given JavaScript value, or a property on an object, represents a valid accessor property descriptor. It specifically checks for the presence of `get` and/or `set` properties and ensures they are functions, while rejecting `value` or `writable` properties which characterize data descriptors. Currently at version 3.0.5, this package is part of a family of descriptor-checking utilities under the `inspect-js` scope, emphasizing foundational JavaScript introspection. Its release cadence is stable and infrequent, reflecting its role as a fundamental helper. It differentiates itself by its precise focus, allowing developers to isolate and validate accessor descriptors without conflating them with other descriptor types, making it a reliable tool for metaprogramming and object property manipulation.
npm install is-accessor-descriptorVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to use `is-accessor-descriptor` to verify if an object's property (by passing the object and key) or a pre-obtained descriptor object is a valid JavaScript accessor descriptor.
Ensure your import statement correctly handles the CJS default export: `import isAccessorDescriptor from 'is-accessor-descriptor';` for ESM, or `const isAccessorDescriptor = require('is-accessor-descriptor');` for CJS.Adjust your import statement to `import isAccessorDescriptor from 'is-accessor-descriptor';` if in ESM, or `const isAccessorDescriptor = require('is-accessor-descriptor');` if in CJS.If your file is an ES Module (e.g., `.mjs` or `"type": "module"` in `package.json`), you must use the ESM import syntax: `import isAccessorDescriptor from 'is-accessor-descriptor';`.
No dependency data recorded yet.