# object-upperkeys

> Convert the keys of an object to uppercase

Latest version **1.0.2** (published 2017-05-25) · MIT license · 0 weekly downloads

## Install

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

## 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.2 |
| Published | 2017-05-25 |
| First published | 2017-04-16 |
| 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 | 1 |
| Author | Gaurav Luthra |
| Maintainers | gluthra |
| Keywords | object, keys, properties, uppercase-keys, upperkeys, uppercase, extend, assign, upper-case, case, keys, key, toUpperCase |

## Links

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

## Dependencies (1)

- [node-ratify](https://npm.io/package/node-ratify.md) ~1.1.0

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2017-05-25
- 1.0.1 — 2017-05-23
- 1.0.0 — 2017-04-16

## README

# object-upperkeys
It provides an API to convert the keys of the object into uppercase. Client of this API can specify if nested keys are also required to be converted to uppercase

### Installation

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

```sh
$ npm install object-upperkeys --save
```

### Usage

```javascript
var UPPERCASE_KEYS = require('object-upperkeys');

var object = {
    'California' : 'CA',
    'Texas'      : 'TX',
    'new york'   : 'NY' 
};

UPPERCASE_KEYS.toUpperCaseKeys(object);
//=> { 'CALIFORNIA' : 'CA', 'TEXAS' : 'TX', 'NEW YORK' : 'NY' }

var days = {
    'sunday'    : 0,
    'monday'    : 1,
    'tuesday'   : 2,
    'wednesday' : 3
};

UPPERCASE_KEYS.toUpperCaseKeys(days);
//=> { 'SUNDAY': 0, 'MONDAY' : 1, 'TUESDAY' : 2, 'WEDNESDAY' : 3 }

```

### Clone the repo

```bash
$ git clone https://github.com/luthraG/object-upperkeys.git
```

### API

#### toUpperCaseKeys(obj, [options])

This API takes two parameters:
1. Object whose keys to be converted to uppercase and 
2. options object. This argument is optional


**Options**

Various options supported by this API are :
- **deep** - To specify if nested keys should also be converted to uppercase. Default is false.

**Example with options**

```javascript
var UPPERCASE_KEYS = require('object-upperkeys');

var days = {
    'Sunday'    : 0,
    'Monday'    : 1,
    'tuesday'   : 2,
    'wednesday' : 3,
    'weekend'  : {
        'Sunday' : 'Fun day',
        'Saturday' : {
            'Code' : {
                'Abbr' : 'sat'
            }
        }
    }
};

UPPERCASE_KEYS.toUpperCaseKeys(days, { deep : true});
//=> { 'SUNDAY': 0, 'MONDAY' : 1, 'TUESDAY' : 2, 'WEDNESDAY' : 3, 'WEEKEND' : 'SUNDAY' : 'Fun day', 'SATURDAY' : { 'CODE' : { 'ABBR' : 'sat' } } }

```

### Related projects

You might also be interested in these projects:

* [object-lowerkeys](https://www.npmjs.com/package/object-lowerkeys): Convert the keys of an object into lowercase. | [homepage](https://github.com/luthraG/object-lowerkeys.git)
* [uppercase-values](https://www.npmjs.com/package/uppercase-values): Convert the values of all the keys of an object into uppercase. | [homepage](https://github.com/luthraG/uppercase-values.git)
* [lowercase-values](https://www.npmjs.com/package/lowercase-values): Convert the values of all the keys of an object into lowercase. | [homepage](https://github.com/luthraG/lowercase-values.git)
* [objectvalues](https://www.npmjs.com/package/objectvalues): To get all the values of an object. It can also fetch the value of nested object of any depth. | [homepage](https://github.com/luthraG/objectvalues.git)

### Author

**Gaurav Luthra**

* [github/luthraG](https://github.com/luthraG)

## License

MIT © [Gaurav Luthra](luthra.zenith@gmail.com)

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