# rename-keys

> Modify the names of the own enumerable properties (keys) of an object.

Latest version **2.0.1** (published 2017-10-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install rename-keys
pnpm add rename-keys
yarn add rename-keys
bun add rename-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.1 |
| Published | 2017-10-13 |
| First published | 2014-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 27 |
| Author | Jon Schlinkert |
| Maintainers | doowb, jonschlinkert |
| Keywords | enumerable, keys, object, properties, rename |

## Links

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

## Dependencies (1)

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

## Recent versions

- 2.0.1 (latest) — 2017-10-13
- 2.0.0 — 2017-10-13
- 1.2.0 — 2017-10-13
- 1.1.3 — 2017-04-03
- 1.1.2 — 2015-01-20
- 1.1.1 — 2015-01-20
- 1.1.0 — 2015-01-20
- 1.0.0 — 2015-01-20
- 0.2.0 — 2014-07-10
- 0.1.1 — 2014-06-15
- 0.1.0 — 2014-02-10

## README

# rename-keys [![NPM version](https://img.shields.io/npm/v/rename-keys.svg?style=flat)](https://www.npmjs.com/package/rename-keys) [![NPM monthly downloads](https://img.shields.io/npm/dm/rename-keys.svg?style=flat)](https://npmjs.org/package/rename-keys) [![NPM total downloads](https://img.shields.io/npm/dt/rename-keys.svg?style=flat)](https://npmjs.org/package/rename-keys) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/rename-keys.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/rename-keys)

> Modify the names of the own enumerable properties (keys) of an object.

Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.

## Install

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

```sh
$ npm install --save rename-keys
```

## Usage

```js
var renameKeys = require('rename-keys');
```

## API

**Params**

* `object` **{Object}**: The object with keys to rename.
* `fn` **{Function}**: Renaming function to use on each key in the object.
* `returns` **{Object}**: Returns a new object with renamed keys.

**Example**

```js
var obj = renameKeys({a: 1, b: 2, c: 3}, function(key, val) {
  return '--' + key;
});
console.log(obj);
//=> { '--a': 1, '--b': 2, '--c': 3}
```

**Rename based on value**

```js
var obj = renameKeys({a: 1, b: 2, c: 3}, function(key, val) {
  return val > 1 ? ('++' + key) : ('--' + key);
});
console.log(obj);
//=> {'--a': 1, '++b': 2, '++c': 3};
```

## About

### Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

### Contributors

| **Commits** | **Contributor** | 
| --- | --- |
| 15 | [jonschlinkert](https://github.com/jonschlinkert) |
| 5 | [doowb](https://github.com/doowb) |
| 2 | [stellard](https://github.com/stellard) |
| 1 | [kof](https://github.com/kof) |
| 1 | [robinbullocks4rb](https://github.com/robinbullocks4rb) |
| 1 | [palanik](https://github.com/palanik) |

### Building docs

_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_

To generate the readme, run the following command:

```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```

### Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

```sh
$ npm install && npm test
```

### Author

**Jon Schlinkert**

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

### License

Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on October 13, 2017._

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