# @cocopina/transform-keys

> Deeply mutate an object's keys

Latest version **1.0.0** (published 2018-11-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install @cocopina/transform-keys
pnpm add @cocopina/transform-keys
yarn add @cocopina/transform-keys
bun add @cocopina/transform-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 | 1.0.0 |
| Published | 2018-11-19 |
| First published | 2018-11-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 23.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sahar Brodbeker |
| Maintainers | cocopina |

## Links

- npm: https://www.npmjs.com/package/@cocopina/transform-keys
- Repository: https://github.com/sahariko/transform-keys
- Issues: https://github.com/sahariko/transform-keys/issues
- npm.io page: https://npm.io/package/@cocopina/transform-keys

## Dependencies (1)

- [is-object-literal](https://npm.io/package/is-object-literal.md) ^1.0.1

## Recent versions

- 1.0.0 (latest) — 2018-11-19

## README

# transform-keys [![](https://img.shields.io/npm/v/@cocopina/transform-keys.svg?colorA=cb3837&colorB=474a50)](https://www.npmjs.com/package/@cocopina/transform-keys)

Creates a deep clone of a JSON data structure with keys transformed by a provided function.

## Table of Contents

- [Installation](#installation)
- [API](#api)
    * [`transformKeys(object, transform, [options])`](#transformkeysobject-transform-options)
        * [`object [Object]`](#object-object)
        * [`transform [Function]`](#transform-function)
        * [`options [Object]`](#options-object)

## Installation

Install the package:
```sh
npm i @cocopina/transform-keys
```

## API

### `transformKeys(object, transform, [options])`

Returns a new, transformed object.

```js
import transformKeys from '@cocopina/transform-keys';

const transformFn = (value) => `_${value}`;
const object = {
    key: 1
};
const transformed = transformKeys(object, transformFn);

console.log(transformed); // {_key: 1}
```

#### `object [Object]`

The object which keys' you wish to transform.

#### `transform [Function]`

The transformation function you wish to use on the object's keys.

#### `options [Object]`

Additional options:

| Option | Type | What It Does | Default |
|------------------|--------------------|-----|-----|
| `deep` | `Boolean` | Whether or not to transform the object's keys recursively | `true` |
| `recursionLevel` | `Number` | How deep should the transformation go | - |

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