You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.
Examples
constisAccessorDescriptor=require('is-accessor-descriptor');constassert=require('assert');constobj={getfoo(){},bar: {get: function(){}}};assert.equal(true,isAccessorDescriptor(obj,'foo'));assert.equal(false,isAccessorDescriptor(obj,'bar'));// or, if you already have the descriptor you can pass it directlyconstfoo=Object.getOwnPropertyDescriptor(obj,'foo');assert.equal(true,isAccessorDescriptor(foo));constbar=Object.getOwnPropertyDescriptor(obj,'bar');assert.equal(false,isAccessorDescriptor(bar));
Related projects
You might also be interested in these projects:
is-data-descriptor: Returns true if a value has the characteristics of a valid JavaScript data descriptor.
is-descriptor: Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… more
is-object: Returns true if the value is an object and not an array or null.
Tests
Simply clone the repo, npm install, and run npm test
About
Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.