# reflect.ownkeys

> ES2015 spec-compliant shim for Reflect.ownKeys

Latest version **1.1.6** (published 2026-01-03) · MIT license · 0 weekly downloads

> **Native alternative:** Reflect.ownKeys — Use native JavaScript (Node 6.0.0+) (https://developer.mozilla.orgGlobal_Objects/Reflect/ownKeys)

## Install

```sh
npm install reflect.ownkeys
pnpm add reflect.ownkeys
yarn add reflect.ownkeys
bun add reflect.ownkeys
```

## Health

**Score 58/100 (C)** — status: stable.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.1.6 |
| Published | 2026-01-03 |
| First published | 2016-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/reflect.ownkeys) |
| Module format | ESM + CommonJS |
| Node | >= 0.4 |
| Dependencies | 6 |
| Unpacked size | 24.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Jordan Harband |
| Maintainers | ljharb, glenjamin |
| Keywords | es6, es2015, reflect, ownkeys, polyfill, shim, es-shim API |

## Links

- npm: https://www.npmjs.com/package/reflect.ownkeys
- Repository: https://github.com/es-shims/Reflect.ownKeys
- Issues: https://github.com/es-shims/Reflect.ownKeys/issues
- Funding: https://github.com/sponsors/ljharb
- npm.io page: https://npm.io/package/reflect.ownkeys

## Dependencies (6)

- [own-keys](https://npm.io/package/own-keys.md) ^1.0.1
- [call-bind](https://npm.io/package/call-bind.md) ^1.0.8
- [globalthis](https://npm.io/package/globalthis.md) ^1.0.4
- [define-properties](https://npm.io/package/define-properties.md) ^1.2.1
- [es-set-tostringtag](https://npm.io/package/es-set-tostringtag.md) ^2.1.0
- [define-data-property](https://npm.io/package/define-data-property.md) ^1.1.4

## Recent versions

- 1.1.6 (latest) — 2026-01-03
- 1.1.5 — 2024-12-30
- 1.1.4 — 2023-08-30
- 1.1.3 — 2023-01-20
- 1.1.2 — 2022-12-21
- 1.1.1 — 2022-11-07
- 1.1.0 — 2021-10-04
- 1.0.2 — 2020-12-24
- 1.0.1 — 2020-02-01
- 1.0.0 — 2020-01-15
- 0.2.0 — 2016-02-06

## README

# reflect.ownkeys <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

[![npm badge][npm-badge-png]][package-url]

An ES2015 spec-compliant `Reflect.ownKeys` shim. Invoke its "shim" method to shim `Reflect.ownKeys` if it is unavailable or noncompliant.

This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://tc39.es/ecma262/#sec-reflect.ownkeys).

Most common usage:
```js
var assert = require('assert');
var ownKeys = require('reflect.ownkeys');

var obj = { a: 1, b: 2, c: 3 };
var expected = ['a', 'b', 'c'];

if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') {
	// for environments with Symbol support
	var sym = Symbol();
	obj[sym] = 4;
	obj.d = sym;
	expected.push(sym, 'd');
}

assert.deepEqual(ownKeys(obj), expected);

if (!Reflect.ownKeys) {
	ownKeys.shim();
}

assert.deepEqual(Reflect.ownKeys(obj), expected);
```

## Tests
Simply clone the repo, `npm install`, and run `npm test`

[package-url]: https://npmjs.com/package/reflect.ownkeys
[npm-version-svg]: https://versionbadg.es/es-shims/Reflect.ownKeys.svg
[deps-svg]: https://david-dm.org/es-shims/Reflect.ownKeys.svg
[deps-url]: https://david-dm.org/es-shims/Reflect.ownKeys
[dev-deps-svg]: https://david-dm.org/es-shims/Reflect.ownKeys/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/Reflect.ownKeys#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/reflect.ownkeys.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/reflect.ownkeys.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/reflect.ownkeys.svg
[downloads-url]: https://npm-stat.com/charts.html?package=reflect.ownkeys
[codecov-image]: https://codecov.io/gh/es-shims/Reflect.ownKeys/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/Reflect.ownKeys/
[actions-image]: https://img.shields.io/github/check-runs/es-shims/Reflect.ownKeys/main
[actions-url]: https://github.com/es-shims/Reflect.ownKeys/actions

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