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

w3c-keyname

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

w3c-keyname - npm Package Compare versions

Comparing version 2.2.3 to 2.2.4

54

index.es.js

@@ -1,2 +0,2 @@

var base = {
export var base = {
8: "Backspace",

@@ -55,6 +55,5 @@ 9: "Tab",

229: "q"
};
exports.base = base;
}
var shift = {
export var shift = {
48: ")",

@@ -70,3 +69,3 @@ 49: "!",

57: "(",
59: ";",
59: ":",
61: "+",

@@ -86,44 +85,43 @@ 173: "_",

229: "Q"
};
exports.shift = shift;
}
var chrome = typeof navigator != "undefined" && /Chrome\/(\d+)/.exec(navigator.userAgent);
var safari = typeof navigator != "undefined" && /Apple Computer/.test(navigator.vendor);
var gecko = typeof navigator != "undefined" && /Gecko\/\d+/.test(navigator.userAgent);
var mac = typeof navigator != "undefined" && /Mac/.test(navigator.platform);
var ie = typeof navigator != "undefined" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
var brokenModifierNames = chrome && (mac || +chrome[1] < 57) || gecko && mac;
var chrome = typeof navigator != "undefined" && /Chrome\/(\d+)/.exec(navigator.userAgent)
var safari = typeof navigator != "undefined" && /Apple Computer/.test(navigator.vendor)
var gecko = typeof navigator != "undefined" && /Gecko\/\d+/.test(navigator.userAgent)
var mac = typeof navigator != "undefined" && /Mac/.test(navigator.platform)
var ie = typeof navigator != "undefined" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent)
var brokenModifierNames = chrome && (mac || +chrome[1] < 57) || gecko && mac
// Fill in the digit keys
for (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i);
for (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i)
// The function keys
for (var i = 1; i <= 24; i++) base[i + 111] = "F" + i;
for (var i = 1; i <= 24; i++) base[i + 111] = "F" + i
// And the alphabetic keys
for (var i = 65; i <= 90; i++) {
base[i] = String.fromCharCode(i + 32);
shift[i] = String.fromCharCode(i);
base[i] = String.fromCharCode(i + 32)
shift[i] = String.fromCharCode(i)
}
// For each code that doesn't have a shift-equivalent, copy the base name
for (var code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code];
for (var code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code]
exports.keyName = function(event) {
export function keyName(event) {
// Don't trust event.key in Chrome when there are modifiers until
// they fix https://bugs.chromium.org/p/chromium/issues/detail?id=633838
var ignoreKey = brokenModifierNames && (event.ctrlKey || event.altKey || event.metaKey) ||
(safari || ie) && event.shiftKey && event.key && event.key.length == 1;
(safari || ie) && event.shiftKey && event.key && event.key.length == 1
var name = (!ignoreKey && event.key) ||
(event.shiftKey ? shift : base)[event.keyCode] ||
event.key || "Unidentified";
event.key || "Unidentified"
// Edge sometimes produces wrong names (Issue #3)
if (name == "Esc") name = "Escape";
if (name == "Del") name = "Delete";
if (name == "Esc") name = "Escape"
if (name == "Del") name = "Delete"
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/
if (name == "Left") name = "ArrowLeft";
if (name == "Up") name = "ArrowUp";
if (name == "Right") name = "ArrowRight";
if (name == "Down") name = "ArrowDown";
if (name == "Left") name = "ArrowLeft"
if (name == "Up") name = "ArrowUp"
if (name == "Right") name = "ArrowRight"
if (name == "Down") name = "ArrowDown"
return name
};
}
{
"name": "w3c-keyname",
"version": "2.2.3",
"version": "2.2.4",
"description": "Get a KeyboardEvent.key-style string from an event",

@@ -35,5 +35,4 @@ "main": "index.cjs",

"devDependencies": {
"rollup": "^1.26.3",
"rollup-plugin-commonjs": "^10.1.0"
"rollup": "^1.26.3"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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