# prop-keys

> Returns an array of the keys of all properties (owned and inherited) of an object.

Latest version **2.0.0** (published 2018-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install prop-keys
pnpm add prop-keys
yarn add prop-keys
bun add prop-keys
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2018-05-23 |
| First published | 2018-04-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.0.0 |
| Dependencies | 2 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | John Lamansky |
| Maintainers | lamansky |
| Keywords | object, own, inherited, properties, keys, array |

## Links

- npm: https://www.npmjs.com/package/prop-keys
- Repository: https://github.com/lamansky/prop-keys
- Issues: https://github.com/lamansky/prop-keys/issues
- npm.io page: https://npm.io/package/prop-keys

## Dependencies (2)

- [sbo](https://npm.io/package/sbo.md) ^1.1.0
- [own-all](https://npm.io/package/own-all.md) ^1.0.0

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2018-05-23
- 1.0.0 — 2018-04-13

## README

# prop-keys

Returns an array of the keys of all properties (owned and inherited) of an object.

## Installation

Requires [Node.js](https://nodejs.org/) 6.0.0 or above.

```bash
npm i prop-keys
```

## API

The module exports a single function.

### Parameters

1. Bindable: `obj` (object): The object whose property keys you want to get.
2. Object argument:
   * Optional: `own` (boolean): If set to `true`, only the object’s “[own](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty)” property keys are returned. If omitted or if set to `false`, both owned and inherited property keys are returned.
   * Optional: `enumOnly` (boolean): If set to `true`, only the keys of properties defined with the `enumerable` flag will be returned.

### Return Value

An array of the keys of object properties.

## Example

```javascript
const keys = require('prop-keys')

keys({key: 'value'}, {own: true}) // ['key']
```

## Related

* [prop-entries](https://github.com/lamansky/prop-entries): Same as this module, except it returns key-value pairs.
* [prop-values](https://github.com/lamansky/prop-values): Same as this module, except it returns values.
* [keys-array](https://github.com/lamansky/keys-array): Supports more than just Objects.

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