react-carousel-query
Version:
A infinite carousel component made with react that handles the pagination for you.
99 lines (73 loc) • 3.64 kB
Markdown
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
> Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.
```js
var isAccessor = require('is-accessor-descriptor');
var assert = require('assert');
assert.equal(isAccessor({ get: function() {} }), true);
```
You may also pass an object and property name to check if the property is an accessor:
```js
assert.equal(isAccessor({ bar: {} }, 'bar'), true);
```
`false` when not an object
```js
assert.equal(isAccessor('a'), false);
assert.equal(isAccessor(null), false);
```
`true` when the object has valid properties
and the properties all have the correct JavaScript types:
```js
assert.equal(isAccessor({ get() {}, set() {} }), true);
assert.equal(isAccessor({ get() {} }), true);
assert.equal(isAccessor({ set() {} }), true);
```
`false` when the object has invalid properties
```js
assert.equal(isAccessor({ get() {}, set() {}, enumerable: 'baz' }), false);
assert.equal(isAccessor({ get() {}, writable: true }), false);
assert.equal(isAccessor({ get() {}, value: true }), false);
```
`false` when an accessor is not a function
```js
isAccessor({ get() {}, set: 'baz' });
isAccessor({ get: 'foo', set() {} });
isAccessor({ get: 'foo', bar: 'baz' });
isAccessor({ get: 'foo', set: 'baz' });
//=> false
```
`false` when a value is not the correct type
```js
isAccessor({ get() {}, set() {}, enumerable: 'foo' });
isAccessor({ set() {}, configurable: 'foo' });
isAccessor({ get() {}, configurable: 'foo' });
//=> false
```
You might also be interested in these projects:
* [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.
* [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/inspect-js/is-descriptor)
* [is-object](https://www.npmjs.com/package/is-object): Returns true if the value is an object and not an array or null.
Simply clone the repo, `npm install`, and run `npm test`
[]: https://npmjs.org/package/is-accessor-descriptor
[]: https://versionbadg.es/inspect-js/is-accessor-descriptor.svg
[]: https://david-dm.org/inspect-js/is-accessor-descriptor.svg
[]: https://david-dm.org/inspect-js/is-accessor-descriptor
[]: https://david-dm.org/inspect-js/is-accessor-descriptor/dev-status.svg
[]: https://david-dm.org/inspect-js/is-accessor-descriptor#info=devDependencies
[]: https://nodei.co/npm/is-accessor-descriptor.png?downloads=true&stars=true
[]: https://img.shields.io/npm/l/is-accessor-descriptor.svg
[]: LICENSE
[]: https://img.shields.io/npm/dm/is-accessor-descriptor.svg
[]: https://npm-stat.com/charts.html?package=is-accessor-descriptor
[]: https://codecov.io/gh/inspect-js/is-accessor-descriptor/branch/main/graphs/badge.svg
[]: https://app.codecov.io/gh/inspect-js/is-accessor-descriptor/
[]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-accessor-descriptor
[]: https://github.com/inspect-js/is-accessor-descriptor/actions