1# is-accessor-descriptor [![NPM version](https://img.shields.io/npm/v/is-accessor-descriptor.svg?style=flat)](https://www.npmjs.com/package/is-accessor-descriptor) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-accessor-descriptor.svg?style=flat)](https://npmjs.org/package/is-accessor-descriptor) [![NPM total downloads](https://img.shields.io/npm/dt/is-accessor-descriptor.svg?style=flat)](https://npmjs.org/package/is-accessor-descriptor) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-accessor-descriptor.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-accessor-descriptor)
2
3> Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.
4
5Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
6
7## Install
8
9Install with [npm](https://www.npmjs.com/):
10
11```sh
12$ npm install --save is-accessor-descriptor
13```
14
15## Usage
16
17```js
18var isAccessor = require('is-accessor-descriptor');
19
20isAccessor({get: function() {}});
21//=> true
22```
23
24You may also pass an object and property name to check if the property is an accessor:
25
26```js
27isAccessor(foo, 'bar');
28```
29
30## Examples
31
32`false` when not an object
33
34```js
35isAccessor('a')
36isAccessor(null)
37isAccessor([])
38//=> false
39```
40
41`true` when the object has valid properties
42
43and the properties all have the correct JavaScript types:
44
45```js
46isAccessor({get: noop, set: noop})
47isAccessor({get: noop})
48isAccessor({set: noop})
49//=> true
50```
51
52`false` when the object has invalid properties
53
54```js
55isAccessor({get: noop, set: noop, bar: 'baz'})
56isAccessor({get: noop, writable: true})
57isAccessor({get: noop, value: true})
58//=> false
59```
60
61`false` when an accessor is not a function
62
63```js
64isAccessor({get: noop, set: 'baz'})
65isAccessor({get: 'foo', set: noop})
66isAccessor({get: 'foo', bar: 'baz'})
67isAccessor({get: 'foo', set: 'baz'})
68//=> false
69```
70
71`false` when a value is not the correct type
72
73```js
74isAccessor({get: noop, set: noop, enumerable: 'foo'})
75isAccessor({set: noop, configurable: 'foo'})
76isAccessor({get: noop, configurable: 'foo'})
77//=> false
78```
79
80## About
81
82<details>
83<summary><strong>Contributing</strong></summary>
84
85Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
86
87</details>
88
89<details>
90<summary><strong>Running Tests</strong></summary>
91
92Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
93
94```sh
95$ npm install && npm test
96```
97
98</details>
99
100<details>
101<summary><strong>Building docs</strong></summary>
102
103_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
104
105To generate the readme, run the following command:
106
107```sh
108$ npm install -g verbose/verb#dev verb-generate-readme && verb
109```
110
111</details>
112
113### Related projects
114
115You might also be interested in these projects:
116
117* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.")
118* [is-data-descriptor](https://www.npmjs.com/package/is-data-descriptor): Returns true if a value has the characteristics of a valid JavaScript data descriptor. | [homepage](https://github.com/jonschlinkert/is-data-descriptor "Returns true if a value has the characteristics of a valid JavaScript data descriptor.")
119* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://github.com/jonschlinkert/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.")
120* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.")
121* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
122
123### Contributors
124
125| **Commits** | **Contributor** |
126| --- | --- |
127| 22 | [jonschlinkert](https://github.com/jonschlinkert) |
128| 2 | [realityking](https://github.com/realityking) |
129
130### Author
131
132**Jon Schlinkert**
133
134* [github/jonschlinkert](https://github.com/jonschlinkert)
135* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
136
137### License
138
139Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
140Released under the [MIT License](LICENSE).
141
142***
143
144_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on November 01, 2017._