1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.RawKeybinding = exports.Keybinding = void 0;
|
4 | var Keybinding;
|
5 | (function (Keybinding) {
|
6 | |
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | function equals(a, b, ignoreKeybinding = false, ignoreArgs = false) {
|
15 | if (a.command === b.command &&
|
16 | (a.context || '') === (b.context || '') &&
|
17 | (a.when || '') === (b.when || '') &&
|
18 | (ignoreKeybinding || a.keybinding === b.keybinding) &&
|
19 | (ignoreArgs || (a.args || '') === (b.args || ''))) {
|
20 | return true;
|
21 | }
|
22 | return false;
|
23 | }
|
24 | Keybinding.equals = equals;
|
25 | |
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | function apiObjectify(binding) {
|
32 | return {
|
33 | command: binding.command,
|
34 | keybinding: retrieveKeybinding(binding),
|
35 | context: binding.context,
|
36 | when: binding.when,
|
37 | args: binding.args
|
38 | };
|
39 | }
|
40 | Keybinding.apiObjectify = apiObjectify;
|
41 | function retrieveKeybinding(binding) {
|
42 | var _a, _b;
|
43 | return (_b = (_a = binding.keybinding) !== null && _a !== void 0 ? _a : binding.key) !== null && _b !== void 0 ? _b : '';
|
44 | }
|
45 | Keybinding.retrieveKeybinding = retrieveKeybinding;
|
46 | |
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | function stringify(binding) {
|
54 | return JSON.stringify(apiObjectify(binding));
|
55 | }
|
56 | Keybinding.stringify = stringify;
|
57 |
|
58 |
|
59 | function is(arg) {
|
60 | return !!arg && arg === Object(arg) && 'command' in arg && 'keybinding' in arg;
|
61 | }
|
62 | Keybinding.is = is;
|
63 | })(Keybinding = exports.Keybinding || (exports.Keybinding = {}));
|
64 | var RawKeybinding;
|
65 | (function (RawKeybinding) {
|
66 | function is(candidate) {
|
67 | return typeof candidate === 'object' && !!candidate && 'command' in candidate && 'key' in candidate;
|
68 | }
|
69 | RawKeybinding.is = is;
|
70 | })(RawKeybinding = exports.RawKeybinding || (exports.RawKeybinding = {}));
|
71 |
|
\ | No newline at end of file |