keyname is a JavaScript utility designed to translate numeric keyboard event key codes into more human-readable string names. For instance, it can convert a key code of `27` to "esc" or `65` to "a". Released as version `0.1.0` and last updated approximately 11 years ago, this package originates from the 'component' ecosystem, which was a frontend package manager system that predated or competed with the widespread adoption of npm for browser-side modules. Consequently, the package is considered abandoned, with no active development, bug fixes, or new features. While it serves its original function of mapping legacy `KeyboardEvent.keyCode` values, its relevance has significantly diminished due to the broad browser support for the native `KeyboardEvent.key` and `KeyboardEvent.code` properties, which directly provide string representations of pressed keys, handling variations in keyboard layouts and modifier states. This means developers typically no longer need a utility like `keyname` for new projects or modern browser targets. It reports having zero runtime dependencies and a minimal number of downstream dependents (8 projects), reflecting its specialized and now largely superseded role.
npm install keynameVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of `keyname` to convert numeric key codes to string names, also noting modern alternatives.
For new projects or modern browser support, prefer `KeyboardEvent.key` or `KeyboardEvent.code`. If targeting very old browsers where `KeyboardEvent.key` is unavailable, consider a more actively maintained polyfill or a library that provides graceful degradation.
Ensure your project or file uses CommonJS (`const keyname = require('keyname');`) or configure your bundler (e.g., Webpack, Rollup, Parcel) to handle CJS modules in an ESM environment. However, migration to native `KeyboardEvent.key` is strongly recommended.Avoid using this package in new development. For existing projects, evaluate the risk and consider migrating to native browser APIs or a actively maintained alternative.
This package is CJS-only. If you must use it, ensure your environment supports CommonJS modules. However, the recommended fix is to migrate away from `keyname` and use `KeyboardEvent.key` directly on the event object.
Access `event.key` directly on the `KeyboardEvent` object instead of using `event.keyCode`. This provides a more robust and localized string representation of the pressed key.
No dependency data recorded yet.