1.1.13 • Published 3 days ago

@hishprorg/tenetur-enim-suscipit v1.1.13

Weekly downloads
-
License
MIT
Repository
github
Last release
3 days ago

@hishprorg/tenetur-enim-suscipit Version Badge

github actions coverage License Downloads

npm badge

Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.

Examples

const isAccessorDescriptor = require('@hishprorg/tenetur-enim-suscipit');
const assert = require('assert');

const obj = {
	get foo() {},
	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 directly
const foo = Object.getOwnPropertyDescriptor(obj, 'foo');
assert.equal(true, isAccessorDescriptor(foo));

const bar = 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

1.1.13

3 days ago

1.1.9

7 days ago

1.1.12

4 days ago

1.1.11

5 days ago

1.1.10

6 days ago

1.1.8

8 days ago

1.1.7

9 days ago

1.1.6

10 days ago

1.1.5

11 days ago

1.1.4

12 days ago

1.0.4

13 days ago

1.0.3

14 days ago

1.0.2

15 days ago

1.0.1

16 days ago