Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

key-event-to-string

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

key-event-to-string - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

17

index.js

@@ -69,2 +69,17 @@ var defaultOptions = {

function details (e) {
var map = buildKeyMap(e)
var mods = map.modifiers
var hasModifier = mods.cmd || mods.ctrl || mods.alt || mods.shift
var result = {
hasKey: map.character != null,
hasModifier: hasModifier,
map: map
}
return result
}
module.exports = function (userOptions) {

@@ -74,1 +89,3 @@ options = Object.assign(defaultOptions, userOptions)

}
module.exports.details = details

2

package.json
{
"name": "key-event-to-string",
"version": "1.0.0",
"version": "1.1.0",
"description": " Converts a JavaScript key event object into a humanly readable format",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -55,2 +55,14 @@ # JavaScript keyboard events to strings

### Detailed information
`event2string.details(e)` can be used to get more details. This can be useful for
validating keyboard shortcuts, e.g. for requiring a modifier and a normal key.
It returns an object with this information:
- `hasModifier`: True iff atleast one of cmd, ctrl, alt or shift was pressed
- `hasKey`: True iff a key other than a modifier is pressed
- `map`: An object containing information which modifier is active and what
other key is pressed
## Disclaimer

@@ -57,0 +69,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc