MCPcopy Index your code
hub / github.com/spicetify/cli / formatKeys

Function formatKeys

jsHelper/spicetifyWrapper.js:1760–1777  ·  view source on GitHub ↗
(keys)

Source from the content-addressed store, hash-verified

1758 };
1759
1760 function formatKeys(keys) {
1761 let keystroke = "";
1762 if (typeof keys === "object") {
1763 if (!keys.key || !Object.values(KEYS).includes(keys.key)) {
1764 throw `Spicetify.Keyboard.registerShortcut: Invalid key ${keys.key}`;
1765 }
1766 if (keys.ctrl) keystroke += "mod+";
1767 if (keys.meta) keystroke += "meta+";
1768 if (keys.alt) keystroke += "alt+";
1769 if (keys.shift) keystroke += "shift+";
1770 keystroke += keys.key;
1771 } else if (typeof keys === "string" && Object.values(KEYS).includes(keys)) {
1772 keystroke = keys;
1773 } else {
1774 throw `Spicetify.Keyboard.registerShortcut: Invalid keys ${keys}`;
1775 }
1776 return keystroke;
1777 }
1778
1779 Spicetify.Keyboard = {
1780 KEYS,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected