{"_id":"os-key","_rev":"409104","name":"os-key","description":"Get the right modifier keys depending on your system","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"elifitch","email":"eli.fitch.prof+npm@gmail.com"}],"time":{"modified":"2021-08-04T05:01:20.000Z","created":"2018-03-12T21:03:23.017Z","1.0.0":"2018-03-13T19:10:36.435Z","0.0.1":"2018-03-12T21:03:23.017Z"},"users":{},"author":{"name":"Eli Fitch","url":"https://github.com/elifitch"},"repository":{"type":"git","url":"git+https://github.com/elifitch/os-key.git"},"versions":{"1.0.0":{"name":"os-key","version":"1.0.0","description":"Get the right modifier keys depending on your system","files":["dist"],"keywords":["command key","ctrl key","alt key","user-agent","key"],"main":"./dist/index.js","scripts":{"build":"rm -rf dist && rollup -c"},"repository":{"type":"git","url":"git+https://github.com/elifitch/os-key.git"},"author":{"name":"Eli Fitch","url":"https://github.com/elifitch"},"license":"MIT","bugs":{"url":"https://github.com/elifitch/os-key/issues"},"homepage":"https://github.com/elifitch/os-key#readme","devDependencies":{"rollup":"^0.56.5","rollup-plugin-buble":"^0.19.2","rollup-plugin-uglify":"^3.0.0"},"dependencies":{},"gitHead":"ab5839aa519f462ede07e564e5566c9699dccea0","_id":"os-key@1.0.0","_npmVersion":"5.3.0","_nodeVersion":"8.2.1","_npmUser":{"name":"elifitch","email":"eli.fitch.prof+npm@gmail.com"},"dist":{"shasum":"088e91deb542e6de5271bbc84547db08909a95e2","size":2679,"noattachment":false,"key":"/os-key/-/os-key-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/os-key/download/os-key-1.0.0.tgz"},"maintainers":[{"name":"elifitch","email":"eli.fitch.prof+npm@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/os-key_1.0.0_1520968236317_0.8812300179121457"},"_hasShrinkwrap":false,"publish_time":1520968236435,"_cnpm_publish_time":1520968236435},"0.0.1":{"name":"os-key","version":"0.0.1","description":"Get the right modifier keys depending on your system","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/elifitch/os-key.git"},"author":{"name":"Eli Fitch","url":"https://github.com/elifitch"},"license":"MIT","bugs":{"url":"https://github.com/elifitch/os-key/issues"},"homepage":"https://github.com/elifitch/os-key#readme","gitHead":"b2f1fdf35140efdb78a1db2f625fea80203b1430","_id":"os-key@0.0.1","_npmVersion":"5.3.0","_nodeVersion":"8.2.1","_npmUser":{"name":"elifitch","email":"eli.fitch.prof+npm@gmail.com"},"dist":{"shasum":"f881dc8b55906a73a12a342efb93c71cc4535206","size":1675,"noattachment":false,"key":"/os-key/-/os-key-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/os-key/download/os-key-0.0.1.tgz"},"maintainers":[{"name":"elifitch","email":"eli.fitch.prof+npm@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/os-key_0.0.1_1520888602938_0.009349375869575516"},"_hasShrinkwrap":false,"publish_time":1520888603017,"_cnpm_publish_time":1520888603017}},"readme":"# OS-Key ⌨️\nSick of not knowing whether to display ⌘ or Ctrl? ⌥ or Alt? Me too. That's what OS-Key takes care of for ya.\n\n## Usage\nInstall it\n`npm install --save os-key`\n\nCall it\n```js\nconst keys = OSKey(navigator.userAgent);\n```\n\nOSKey returns an object that contains information about the special keys of the users operating system\n```js\n  {\n    // Name of the OS\n    os: 'Mac OS' || 'Windows' || 'Linux',\n    // Whether the meta key is used for primary actions, like copying and pasting. A fun quirk of Mac OS\n    primaryMeta: true || false,\n    // This library assumes that most linux users are using windows keyboards, and their meta key is the windows key\n    meta: {\n      name: 'Command' || 'Windows Key',\n      abbreviation: 'Cmd' || 'Win',\n      symbol: '⌘' || '⊞'\n    },\n    // Mac OS uses a slightly different symbol for the Ctrl key \n    ctrl: {\n      name: 'Control',\n      abbreviation: 'Ctrl',\n      symbol: '⌃' || '^'\n    },\n    alt: {\n      name: 'Option (alt)' || 'Alt',\n      abbreviation: 'Alt',\n      symbol: '⌥' || ''\n    }\n  }\n```\n\nIf there are no OS Keys, for example, if a user is on IOS, OSKey will return `undefined`\n\n## Example: ⌘+C / Ctrl+C\nOne of the most common use cases for this library is determining whether to show Ctrl+C or ⌘+C for a `copy` dialogue/tooltip/whatever. This is an example of how you'd use OS-Key to help you with that.\n```js\nimport OSKey from 'os-key';\n\nconst keys = OSKey(navigator.userAgent);\n\nlet content = '';\nif (keys && keys.primaryMeta) {\n  // ⌘+C\n  content = `${keys.meta.symbol}+C`; \n} else {\n  // Ctrl+C\n  content = `${keys.ctrl.abbreviation}+C`;\n}\n```\n","_attachments":{},"homepage":"https://github.com/elifitch/os-key#readme","bugs":{"url":"https://github.com/elifitch/os-key/issues"},"license":"MIT"}