key-display-names
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

key-display-names

npm NPM npm bundle size

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:

<script src="https://joker876.github.io/key-names/key-names.min.js">

And access the function from a global object:

KeyNames.keyToString(/* ... */);

Usage

import { keyToString } from 'key-display-names';
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.

/key-display-names/

    Package Sidebar

    Install

    npm i key-display-names

    Weekly Downloads

    3

    Version

    1.3.0

    License

    MIT

    Unpacked Size

    12.4 kB

    Total Files

    8

    Last publish

    Collaborators

    • joker876