Socket
Socket
Sign inDemoInstall

@stoplight/command

Package Overview
Dependencies
Maintainers
5
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stoplight/command - npm Package Compare versions

Comparing version 0.0.18 to 0.0.19

4

lib/command.d.ts

@@ -69,2 +69,6 @@ import { Event, IDisposable } from '@stoplight/common/lib/types';

/**
* Get a handler of specific type or `undefined`.
*/
getHandler(type: string, commandId: string, ...args: any[]): ICommandHandler | void;
/**
* Get a visible handler for the given command or `undefined`.

@@ -71,0 +75,0 @@ */

40

lib/command.js

@@ -261,8 +261,8 @@ "use strict";

/**
* Get a visible handler for the given command or `undefined`.
* Get a handler of specific type or `undefined`.
*/
CommandRegistry.prototype.getVisibleHandler = function (commandId) {
CommandRegistry.prototype.getHandler = function (type, commandId) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}

@@ -273,3 +273,3 @@ var handlers = this._handlers[commandId];

var handler = handlers_1[_a];
if (!handler.isVisible || handler.isVisible.apply(handler, args)) {
if (!handler[type] || handler[type].apply(handler, args)) {
return handler;

@@ -281,2 +281,12 @@ }

/**
* Get a visible handler for the given command or `undefined`.
*/
CommandRegistry.prototype.getVisibleHandler = function (commandId) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return this.getHandler.apply(this, ['isVisible', commandId].concat(args));
};
/**
* Get a handler that is currently executing for the given command or `undefined`.

@@ -289,11 +299,3 @@ */

}
var handlers = this._handlers[commandId];
if (handlers) {
for (var _a = 0, handlers_2 = handlers; _a < handlers_2.length; _a++) {
var handler = handlers_2[_a];
if (handler.isExecuting && handler.isExecuting.apply(handler, args)) {
return handler;
}
}
}
return this.getHandler.apply(this, ['isExecuting', commandId].concat(args));
};

@@ -308,11 +310,3 @@ /**

}
var handlers = this._handlers[commandId];
if (handlers) {
for (var _a = 0, handlers_3 = handlers; _a < handlers_3.length; _a++) {
var handler = handlers_3[_a];
if (!handler.isEnabled || handler.isEnabled.apply(handler, args)) {
return handler;
}
}
}
return this.getHandler.apply(this, ['isEnabled', commandId].concat(args));
};

@@ -319,0 +313,0 @@ /**

{
"name": "@stoplight/command",
"version": "0.0.18",
"version": "0.0.19",
"description": "Stoplight command registry implementation.",

@@ -15,3 +15,2 @@ "main": "lib/index.js",

"prepublishOnly": "yarn build",
"prebuild": "yarn clean",
"build": "NODE_ENV=production yarn build.module",

@@ -21,11 +20,11 @@ "build.module": "tsc --outDir ./lib",

"start": "NODE_ENV=development yarn build.module -w",
"clean": "git clean -fdX .",
"lint": "tslint 'src/**/*.ts'"
"clean": "git clean -fdX ."
},
"dependencies": {
"@stoplight/common": "^0.0.18",
"@stoplight/ioc": "^0.0.17",
"@stoplight/common": "^0.0.19",
"@stoplight/ioc": "^0.0.19",
"keyboardjs": "2.4.x",
"tslib": "1.x.x"
}
},
"gitHead": "5651dde9d1be1c234b9282bbc5bc155c47f39e66"
}

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