# delightful-keycodes

> Package for converting ascii code to characters and vice versa.

Latest version **1.1.0** (published 2017-02-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install delightful-keycodes
pnpm add delightful-keycodes
yarn add delightful-keycodes
bun add delightful-keycodes
```

## 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.1.0 |
| Published | 2017-02-15 |
| First published | 2017-02-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jordan Campbell |
| Maintainers | jc14 |
| Keywords | keycode, ascii, converter, conversion, delightful, keycodes |

## Links

- npm: https://www.npmjs.com/package/delightful-keycodes
- Repository: https://github.com/jc14/delightful-keycodes
- Homepage: https://github.com/jc14/delightful-keycodes#readme
- Issues: https://github.com/jc14/delightful-keycodes/issues
- npm.io page: https://npm.io/package/delightful-keycodes

## Recent versions

- 1.1.0 (latest) — 2017-02-15
- 1.0.2 — 2017-02-14
- 1.0.1 — 2017-02-14
- 1.0.0 — 2017-02-14

## README

### Usage
``` javascript
const dk = require('delightful-keycodes');

let key = dk(99);
// key => 'c'
```

delightful-keycodes can take multiple types of values and automatically convert the keyCode to the correct character.

### Example

##### Plain Ascii keyCode
``` javascript
let keyCode = 99;

dk(keyCode) // => 'c'
```

##### Browser key press events
``` javascript
let keyPressEvent = {
  keyCode = 99
}

dk(keyPressEvent) // => 'c'
```

##### Events with key property
``` javascript
let keyPressEvent2 = {
  key: 'f',
  keyCode = 99
}

dk(keyPressEvent2) // => 'f'
```

Chrome automatically converts the keyCode for you and provides it in the key property. This is showing that delightful-keycodes won't convert the keyCode if a key is already provided.

This feature exists only because Safari doesn't convert the keyCode for you so you can throw the event into delightful-keycodes
regardless of the browser and it's smart enough to decide whether it needs to convert or not.

### Planned Features
* Ability to take a character as an argument and automatically convert it to the proper keyCode.

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