# key-display-names

> Convert key codes to easily readable names.

Latest version **2.0.0** (published 2025-03-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install key-display-names
pnpm add key-display-names
yarn add key-display-names
bun add key-display-names
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2025-03-18 |
| First published | 2023-04-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | joker876 |
| Maintainers | joker876 |
| Keywords | key-names, keys, keycodes, keynames, keyboard, shortcut |

## Links

- npm: https://www.npmjs.com/package/key-display-names
- Repository: https://github.com/joker876/key-names
- Homepage: https://github.com/joker876/key-names#readme
- Issues: https://github.com/joker876/key-names/issues
- npm.io page: https://npm.io/package/key-display-names

## Recent versions

- 2.0.0 (latest) — 2025-03-18
- 1.3.0 — 2024-08-24
- 1.2.0 — 2023-06-10
- 1.1.1 — 2023-06-09
- 1.1.0 — 2023-04-10
- 1.0.0 — 2023-04-10

## README

# key-display-names
![npm](https://img.shields.io/npm/v/key-display-names?label=version) ![NPM](https://img.shields.io/npm/l/key-display-names) ![npm bundle size](https://img.shields.io/bundlephobia/min/key-display-names)

Manage your undo/redo operations with ease!

## Highlights
* Supports TypeScript!
* Supports Node and browser
* Includes full JSDoc documentation
* Very lightweight!
* Contains tests


## Installation
### NodeJS
```
npm install key-display-names --save
```

### Browser
Import the script:
```html
<script src="https://joker876.github.io/key-names/key-names.min.js">
```
And access the function from a global object:
```js
KeyNames.keyToString(/* ... */);
```

## Usage
```typescript
import { keyToString } from 'key-display-names';
```

```typescript
keyToString(key: string, useShort: boolean = true): string;
```
The **keyToString** function converts a computer-readable key code string to a human-readable string.

The main purpose for this function is to be used for displaying keyboard shortcuts and other similar cases.

* `key` - the key code string to convert. In most cases case-insensitive, however for 100% reliability use PascalCase.
* `useShort` - whether the output string should use a shortened version, if available. Optional, defaults to `true`.

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