canonical
Version:
Canonical code style linter and formatter for JavaScript, SCSS, CSS and JSON.
58 lines (41 loc) • 1.87 kB
Markdown
# is-get-set-prop
[](https://badge.fury.io/js/is-get-set-prop) [](https://travis-ci.org/dustinspecker/is-get-set-prop) [](https://coveralls.io/r/dustinspecker/is-get-set-prop?branch=master)
[](https://codeclimate.com/github/dustinspecker/is-get-set-prop) [](https://david-dm.org/dustinspecker/is-get-set-prop/#info=dependencies&view=table) [](https://david-dm.org/dustinspecker/is-get-set-prop/#info=devDependencies&view=table)
> Does a JS type have a getter/setter property
## Install
```
npm install --save is-get-set-prop
```
## Usage
### ES2015
```javascript
import isGetSetProp from 'is-get-set-prop';
isGetSetProp('array', 'length');
// => true
isGetSetProp('ARRAY', 'push');
// => false
// is-get-set-prop can only verify native JS types
isGetSetProp('gulp', 'task');
// => false;
```
### ES5
```javascript
var isGetSetProp = require('is-get-set-prop');
isGetSetProp('array', 'length');
// => true
isGetSetProp('ARRAY', 'push');
// => false
// is-get-set-prop can only verify native JS types
isGetSetProp('customObject', 'customGetterOrSetter');
// => false;
```
## API
### isGetSetProp(type, propertyName)
#### type
Type: `string`
A native JS type to examine. Note: `is-get-set-prop` can only verify native JS types.
#### propertyName
Type: `string`
Property name to determine if a getter/setter of `type`.
## LICENSE
MIT © [Dustin Specker](https://github.com/dustinspecker)