Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Mar 30, 2024 via pnpm

keycode 2.2.0

Convert between keyboard keycodes and keynames and vice versa.
Package summary
Share
0
issues
1
license
1
MIT
Package created
15 Aug 2013
Version published
21 Mar 2018
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
keycode@2.2.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of keycode 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does keycode do?

Keycode is a popular package on npm which provides a simple map of keyboard codes, allowing developers to easily convert between keyboard keycodes and key names, and vice versa. It is capable of intelligently determining what you're trying to accomplish based on the type of argument you supply. This means the keycode package can give you the name of the key associated with an event, return the lowercase name of a given numeric keycode, or provide the numeric keycode for a given key name. Built with a determination to simplify the process of keyboard event handling in your coding projects, keycode is a versatile tool for JavaScript developers.

How do you use keycode?

The installation of keycode can be achieved through npm or component. To install it using npm, use the command npm install keycode. For component, use component install timoxley/keycode. Once installed, you can require the keycode package in your JavaScript file using var keycode = require('keycode');.

Usage examples:

//Listen for keydown event and log the name of the key pressed
document.addEventListener('keydown', function(e) {
  console.log("You pressed", keycode(e))
})
//Retrieve the name of the key by providing the numeric keycode
console.log(keycode(13)) //Outputs: 'enter'
//Log the numeric keycode by providing the name of the key
console.log(keycode('Enter')) //Outputs: 13
//Note: keycode is not case sensitive
//Test if a keyboard event matches a given name or keycode
keycode.isEventKey(event, 'enter') //Output: true if 'Enter' key was pressed
keycode.isEventKey(event, 13) //Output: true if 'Enter' key was pressed

Where are the keycode docs?

The documentation for the keycode package can be found directly on its GitHub page. This includes a list of all current APIs, descriptions of what each one does, and examples of how to use them. The GitHub page also provides access to the package's source code, enabling developers to dig deeper into its workings as needed, contributing to its continuous development and the overall advancement of the JavaScript community. More in-depth usage descriptions, privacy policies, guides, and collaborations with the community can also be found there. Make sure to check it out for comprehensive details about the keycode package.