# keys-length

> Get the length of the keys on an object. Much faster than Object.keys()

Latest version **0.1.0** (published 2015-05-12) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2015-05-12 |
| First published | 2015-05-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert |

## Links

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

## Dependencies (1)

- [isobject](https://npm.io/package/isobject.md) ^1.0.0

## Recent versions

- 0.1.0 (latest) — 2015-05-12

## README

# keys-length [![NPM version](https://badge.fury.io/js/keys-length.svg)](http://badge.fury.io/js/keys-length)

> Get the length of the keys on an object. Much faster than Object.keys()

If you need the length of an object's properties, **excluding prototype properties**, use [object-length](https://github.com/jonschlinkert/object-length)

## Install

Install with [npm](https://www.npmjs.com/)

```bash
npm i keys-length --save
```

## Usage

```js
var len = require('keys-length');

len({a: 'b', c: 'd', e: 'f'});
//=> 3
```

## Related projects

* [expand-object](https://github.com/jonschlinkert/expand-object): Expand a string into a JavaScript object using a simple notation.
* [object-length](https://github.com/jonschlinkert/object-length): Get the length of an object's properties, excluding prototype properties. Works with dontEnum bugs.

## Comparison to `Object.keys()`

```sh
#1: 2 keys
  'for-in loop' x 24,570,016 ops/sec ±0.65% (93 runs sampled)
  'Object.keys()' x 3,840,164 ops/sec ±0.62% (97 runs sampled)

#2: 5 keys
  'for-in loop' x 22,487,684 ops/sec ±0.83% (91 runs sampled)
  'Object.keys()' x 3,169,150 ops/sec ±0.59% (97 runs sampled)

#3: 10 keys
  'for-in loop' x 20,201,512 ops/sec ±1.06% (94 runs sampled)
  'Object.keys()' x 2,519,700 ops/sec ±0.62% (94 runs sampled)

#4: 52 keys
  'for-in loop' x 10,519,640 ops/sec ±0.61% (97 runs sampled)
  'Object.keys()' x 791,094 ops/sec ±0.63% (94 runs sampled)
```

## Running tests

Install dev dependencies:

```bash
npm i -d && npm test
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/keys-length/issues/new)

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright (c) 2015 Jon Schlinkert
Released under the MIT license.

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 12, 2015._

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