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

atom-keymap

Package Overview
Dependencies
Maintainers
1
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atom-keymap - npm Package Compare versions

Comparing version 0.11.0 to 0.12.0

27

lib/helpers.js

@@ -27,5 +27,14 @@ (function() {

exports.normalizeKeystrokes = function(keystrokes) {
return keystrokes.split(/\s+/).map(function(keystroke) {
return normalizeKeystroke(keystroke);
}).join(' ');
var keystroke, normalizedKeystroke, normalizedKeystrokes, _k, _len2, _ref3;
normalizedKeystrokes = [];
_ref3 = keystrokes.split(/\s+/);
for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) {
keystroke = _ref3[_k];
if (normalizedKeystroke = normalizeKeystroke(keystroke)) {
normalizedKeystrokes.push(normalizedKeystroke);
} else {
return false;
}
}
return normalizedKeystrokes.join(' ');
};

@@ -118,12 +127,16 @@

normalizeKeystroke = function(keystroke) {
var key, keys, modifiers, primaryKey, _k, _len2;
var i, key, keys, modifiers, primaryKey, _k, _len2;
keys = parseKeystroke(keystroke);
primaryKey = null;
modifiers = new Set;
for (_k = 0, _len2 = keys.length; _k < _len2; _k++) {
key = keys[_k];
for (i = _k = 0, _len2 = keys.length; _k < _len2; i = ++_k) {
key = keys[i];
if (AtomModifiers.has(key)) {
modifiers.add(key);
} else {
primaryKey = key;
if (i === keys.length - 1) {
primaryKey = key;
} else {
return false;
}
}

@@ -130,0 +143,0 @@ }

(function() {
var KeyBinding, calculateSpecificity, normalizeKeystrokes, _ref;
var KeyBinding, calculateSpecificity;
_ref = require('./helpers'), normalizeKeystrokes = _ref.normalizeKeystrokes, calculateSpecificity = _ref.calculateSpecificity;
calculateSpecificity = require('./helpers').calculateSpecificity;

@@ -14,3 +14,3 @@ module.exports = KeyBinding = (function() {

this.command = command;
this.keystrokes = normalizeKeystrokes(keystrokes);
this.keystrokes = keystrokes;
this.keystroke = this.keystrokes;

@@ -17,0 +17,0 @@ this.keystrokeCount = this.keystrokes.split(' ').length;

(function() {
var CSON, CommandEvent, Emitter, File, KeyBinding, Keymap, OtherPlatforms, Platforms, fs, isAtomModifier, keydownEvent, keystrokeForKeyboardEvent, path, _ref,
var CSON, CommandEvent, Emitter, File, KeyBinding, Keymap, OtherPlatforms, Platforms, fs, isAtomModifier, keydownEvent, keystrokeForKeyboardEvent, normalizeKeystrokes, path, _ref,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

@@ -19,3 +19,3 @@

_ref = require('./helpers'), keystrokeForKeyboardEvent = _ref.keystrokeForKeyboardEvent, isAtomModifier = _ref.isAtomModifier, keydownEvent = _ref.keydownEvent;
_ref = require('./helpers'), normalizeKeystrokes = _ref.normalizeKeystrokes, keystrokeForKeyboardEvent = _ref.keystrokeForKeyboardEvent, isAtomModifier = _ref.isAtomModifier, keydownEvent = _ref.keydownEvent;

@@ -74,3 +74,3 @@ Platforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32'];

Keymap.prototype.addKeyBindings = function(source, keyBindingsBySelector) {
var command, e, keyBinding, keyBindings, keystroke, selector;
var command, e, keyBinding, keyBindings, keystrokes, normalizedKeystrokes, selector;
for (selector in keyBindingsBySelector) {

@@ -85,6 +85,10 @@ keyBindings = keyBindingsBySelector[selector];

}
for (keystroke in keyBindings) {
command = keyBindings[keystroke];
keyBinding = new KeyBinding(source, command, keystroke, selector);
this.keyBindings.push(keyBinding);
for (keystrokes in keyBindings) {
command = keyBindings[keystrokes];
if (normalizedKeystrokes = normalizeKeystrokes(keystrokes)) {
keyBinding = new KeyBinding(source, command, normalizedKeystrokes, selector);
this.keyBindings.push(keyBinding);
} else {
console.warn("Invalid keystroke sequence for binding: `" + keystrokes + ": " + command + "` in " + source);
}
}

@@ -91,0 +95,0 @@ }

{
"name": "atom-keymap",
"version": "0.11.0",
"version": "0.12.0",
"description": "Atom's DOM-aware keymap module",

@@ -5,0 +5,0 @@ "main": "./lib/keymap",

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