keyboard-key
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "keyboard-key", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": | ||
@@ -40,3 +40,3 @@ "A simple utility for determining the KeyboardEvent.key property from a keyboard event.", | ||
"devDependencies": { | ||
"babel-eslint": "^7.2.3", | ||
"babel-eslint": "^8.0.0", | ||
"eslint": "^4.4.1", | ||
@@ -43,0 +43,0 @@ "eslint-config-prettier": "^2.3.0", |
keyboard-key | ||
[![CircleCI](https://img.shields.io/circleci/project/github/levithomason/keyboard-key.svg?style=flat-square)]() | ||
[![David](https://img.shields.io/david/levithomason/keyboard-key.svg?style=flat-square)]() | ||
[![npm](https://img.shields.io/npm/v/keyboard-key.svg?style=flat-square)]() | ||
[![CircleCI](https://img.shields.io/circleci/project/github/levithomason/keyboard-key.svg?style=flat-square)](https://circleci.com/gh/levithomason/keyboard-key) | ||
[![Codecov](https://img.shields.io/codecov/c/github/levithomason/keyboard-key/master.svg?style=flat-square)](https://codecov.io/gh/levithomason/keyboard-key) | ||
[![David](https://img.shields.io/david/levithomason/keyboard-key.svg?style=flat-square)](https://david-dm.org/levithomason/keyboard-key) | ||
[![npm](https://img.shields.io/npm/v/keyboard-key.svg?style=flat-square)](https://www.npmjs.com/package/keyboard-key) | ||
============ | ||
@@ -6,0 +7,0 @@ |
@@ -1,4 +0,8 @@ | ||
const isObject = val => val !== null && !Array.isArray(val) && typeof val === 'object' | ||
'use strict' | ||
const codes = { | ||
var isObject = function isObject(val) { | ||
return val !== null && !Array.isArray(val) && typeof val === 'object' | ||
} | ||
var codes = { | ||
// ---------------------------------------- | ||
@@ -77,3 +81,3 @@ // By Code | ||
// Function Keys (F1-24) | ||
for (let i = 0; i < 24; i += 1) { | ||
for (var i = 0; i < 24; i += 1) { | ||
codes[112 + i] = 'F' + (i + 1) | ||
@@ -83,9 +87,9 @@ } | ||
// Alphabet (a-Z) | ||
for (let i = 0; i < 26; i += 1) { | ||
const n = i + 65 | ||
for (var j = 0; j < 26; j += 1) { | ||
var n = j + 65 | ||
codes[n] = [String.fromCharCode(n + 32), String.fromCharCode(n)] | ||
} | ||
const keyboardKey = { | ||
codes, | ||
var keyboardKey = { | ||
codes: codes, | ||
@@ -100,3 +104,3 @@ /** | ||
*/ | ||
getCode(name) { | ||
getCode: function getCode(name) { | ||
if (isObject(name)) { | ||
@@ -116,5 +120,5 @@ return name.keyCode || name.which || this[name.key] | ||
*/ | ||
getKey(code) { | ||
const isEvent = isObject(code) | ||
let name = codes[isEvent ? code.keyCode || code.which : code] | ||
getKey: function getKey(code) { | ||
var isEvent = isObject(code) | ||
var name = codes[isEvent ? code.keyCode || code.which : code] | ||
@@ -121,0 +125,0 @@ if (Array.isArray(name)) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
142576
480
87