# object-descriptors

> A pretty well typed `Object.getOwnPropertyDescriptors` polyfill.

Latest version **0.2.1** (published 2021-08-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install object-descriptors
pnpm add object-descriptors
yarn add object-descriptors
bun add object-descriptors
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2021-08-31 |
| First published | 2018-08-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Vitor Luiz Cavalcanti |
| Maintainers | vitorluizc |
| Keywords | Object.getOwnPropertyDescriptors, descriptor, property descriptor, property-descriptor, property-descriptors, properties, property, own-keys, keys, object, ES8, ES2017, shim, polyfill, getOwnPropertyDescriptor, es-shim API |

## Links

- npm: https://www.npmjs.com/package/object-descriptors
- Repository: https://github.com/VitorLuizC/object-descriptors
- Homepage: https://github.com/VitorLuizC/object-descriptors#readme
- Issues: https://github.com/VitorLuizC/object-descriptors/issues
- npm.io page: https://npm.io/package/object-descriptors

## Recent versions

- 0.2.1 (latest) — 2021-08-31
- 0.2.0 — 2019-07-22
- 0.1.0 — 2018-08-09

## README

# object-descriptors

[![Build Status](https://travis-ci.org/VitorLuizC/object-descriptors.svg?branch=master)](https://travis-ci.org/VitorLuizC/object-descriptors)

A pretty well typed `Object.getOwnPropertyDescriptors` polyfill.

## Install

This module is published under NPM registry, so you can install from any package manager.

```sh
npm install object-descriptors --save

# Use the command below if you're using Yarn.
yarn add object-descriptors
```

## Usage

Import `getDescriptors` function and get property descriptors from any object.

> I'm exporting `PropertyDescriptors` type too, so you can use on your TypeScript/JSDoc types.

```ts
import getDescriptors, { PropertyDescriptors } from 'object-descriptors';

const value = {
  name: 'Ryan',
  sayName() {
    console.log(this.name);
  },
};

let descriptors: PropertyDescriptors<{ name: string; sayName: () => void }>;

descriptors = getDescriptors(value);

console.log(descriptors);
// => {
//   name: {
//     value: 'Ryan',
//     writable: true,
//     enumerable: true,
//     configurable: true
//   },
//   sayName: {
//     value: ƒ sayName(),
//     writable: true,
//     enumerable: true,
//     configurable: true
//   }
// }
```

## License

Released under [MIT License](./LICENSE).

---
_Source: https://npm.io/package/object-descriptors · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
