# object-keys

> An Object.keys replacement, in case Object.keys is not available. From https://github.com/es-shims/es5-shim

Latest version **1.1.1** (published 2019-04-07) · MIT license · 0 weekly downloads

> **Native alternative:** Object.keys(obj) — Use native JavaScript (Node 0.10.0+) (https://developer.mozilla.orgGlobal_Objects/Object/keys)

## Install

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

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2019-04-07 |
| First published | 2013-03-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/object-keys) |
| Module format | CommonJS |
| Node | >= 0.4 |
| Dependencies | 0 |
| Unpacked size | 25.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 44 |
| Author | Jordan Harband |
| Maintainers | ljharb |
| Keywords | Object.keys, keys, ES5, shim |

## Links

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

## Recent versions

- 1.1.1 (latest) — 2019-04-07
- 1.1.0 — 2019-02-11
- 1.0.12 — 2018-06-18
- 1.0.11 — 2016-07-05
- 1.0.10 — 2016-07-04
- 1.0.9 — 2015-10-19
- 1.0.8 — 2015-10-14
- 1.0.7 — 2015-07-18
- 1.0.6 — 2015-07-09
- 1.0.5 — 2015-07-03
- 1.0.4 — 2015-05-23
- 1.0.3 — 2015-01-06
- 1.0.2 — 2014-12-28
- 1.0.1 — 2014-09-03
- 1.0.0 — 2014-08-26
- … 17 more at https://npm.io/package/object-keys/versions

## README

#object-keys <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

[![Build Status][travis-svg]][travis-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]

[![browser support][testling-svg]][testling-url]

An Object.keys shim. Invoke its "shim" method to shim Object.keys if it is unavailable.

Most common usage:
```js
var keys = Object.keys || require('object-keys');
```

## Example

```js
var keys = require('object-keys');
var assert = require('assert');
var obj = {
	a: true,
	b: true,
	c: true
};

assert.deepEqual(keys(obj), ['a', 'b', 'c']);
```

```js
var keys = require('object-keys');
var assert = require('assert');
/* when Object.keys is not present */
delete Object.keys;
var shimmedKeys = keys.shim();
assert.equal(shimmedKeys, keys);
assert.deepEqual(Object.keys(obj), keys(obj));
```

```js
var keys = require('object-keys');
var assert = require('assert');
/* when Object.keys is present */
var shimmedKeys = keys.shim();
assert.equal(shimmedKeys, Object.keys);
assert.deepEqual(Object.keys(obj), keys(obj));
```

## Source
Implementation taken directly from [es5-shim][es5-shim-url], with modifications, including from [lodash][lodash-url].

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

[package-url]: https://npmjs.org/package/object-keys
[npm-version-svg]: http://versionbadg.es/ljharb/object-keys.svg
[travis-svg]: https://travis-ci.org/ljharb/object-keys.svg
[travis-url]: https://travis-ci.org/ljharb/object-keys
[deps-svg]: https://david-dm.org/ljharb/object-keys.svg
[deps-url]: https://david-dm.org/ljharb/object-keys
[dev-deps-svg]: https://david-dm.org/ljharb/object-keys/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/object-keys#info=devDependencies
[testling-svg]: https://ci.testling.com/ljharb/object-keys.png
[testling-url]: https://ci.testling.com/ljharb/object-keys
[es5-shim-url]: https://github.com/es-shims/es5-shim/blob/master/es5-shim.js#L542-589
[lodash-url]: https://github.com/lodash/lodash
[npm-badge-png]: https://nodei.co/npm/object-keys.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/object-keys.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/object-keys.svg
[downloads-url]: http://npm-stat.com/charts.html?package=object-keys

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