Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.
Install
Install with npm
$ npm i is-descriptor --save
Usage
var isDescriptor = ; //=> true//=> true//=> false
Examples
value type
false
when not an object
)//=> false)//=> false)//=> false
data descriptor
true
when the object has valid properties with valid values.
)//=> true)//=> true
false
when the object has invalid properties
)//=> false)//=> false)//=> false)//=> false
false
when a value is not the correct type
)//=> false)//=> false)//=> false
accessor descriptor
true
when the object has valid properties with valid values.
)//=> true)//=> true)//=> true
false
when the object has invalid properties
)//=> false)//=> false)//=> false
false
when an accessor is not a function
)//=> false)//=> false)//=> false)//=> false
false
when a value is not the correct type
)//=> false)//=> false)//=> false
Related projects
- is-accessor-descriptor: Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | homepage
- is-data-descriptor: Returns true if a value has the characteristics of a valid JavaScript data descriptor. | homepage
- isobject: Returns true if the value is an object and not an array or null. | homepage
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb on December 20, 2015.