New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

keycode-to-codes

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keycode-to-codes

Library that returns a list of KeyboardEvent codes based the input keyCode

latest
Source
npmnpm
Version
2.0.5
Version published
Weekly downloads
1
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

npm

keycode-to-codes

Library that returns a list of possible KeyboardEvent codes based the input keyCode. Useful for replacing a missing KeyboardEvent.code property.

Example: 13 -> ["Enter", "NumpadEnter"]
32 -> ["Space"]
97 -> ["KeyA"]

Installation

Add the script to your project through a package manager:

$ npm i keycode-to-codes

or

$ yarn add keycode-to-codes

Alternatively you can also import the script found in the releases section on GitHub directly. If you choose this option you won't need to use imports going forward - everything will all be available to you automatically.

<script src="keycode-to-codes.min.js"></script>

Or include through a public CDN:

<script src="https://unpkg.com/keycode-to-codes@2/dist/keycode-to-codes.min.js"></script>

Usage Example

  import keyCodeToCodes from 'keycode-to-codes';
  // OR
  const keyCodeToCodes = require('keycode-to-codes');

  window.addEventListener('keypress', (event) => {
    const codes = keyCodeToCodes(event.keyCode);
  });

Keywords

ms-edge-fix

FAQs

Package last updated on 21 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts