# keypress-util

> Utility to help identify pressed keys and evaluate keycodes

Latest version **1.0.0** (published 2022-07-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install keypress-util
pnpm add keypress-util
yarn add keypress-util
bun add keypress-util
```

## 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 | 2022-07-13 |
| First published | 2022-07-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ttse76 |
| Maintainers | ttse76 |
| Keywords | keypress, keycode, utility, dictionary |

## Links

- npm: https://www.npmjs.com/package/keypress-util
- Repository: https://github.com/ttse76/keypress-util
- Homepage: https://github.com/ttse76/keypress-util#readme
- Issues: https://github.com/ttse76/keypress-util/issues
- npm.io page: https://npm.io/package/keypress-util

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2022-07-13
- 0.0.1 — 2022-07-13

## README

# Keypress Util
![test](https://github.com/ttse76/keypress-util/actions/workflows/node.js.yml/badge.svg)

A lightweight module for getting keycodes

## Installation
`npm i keypress-util`

## Usage
To find a key, import the `KEY_CODES` object, then find the key in the list of keys.
```javascript
const { KEY_CODES } = require('keypress-util');
const code = KEY_CODES.SHIFT; // 16
```
To get a key based on a code, import the `getKey` function. All keycodes are numbers, `getKey` returns `"NONE"` if the keycode is either not a number or an invalid key. Numbers as a string are valid as long as the number is a valid keycode.
```javascript
const { getKey } = require('keypress-util');

const k0 = getKey(16); // "SHIFT"
const k1 = getKey('45') // "INSERT"
const k2 = getKey(500); // "NONE"
const k3 = getKey("Invalid Key"); // "NONE"
```

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