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

electron-shortcut-normalizer

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-shortcut-normalizer

Normalize electron keyboard shortcuts so they work on different operating systems

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43
decreased by-37.68%
Maintainers
1
Weekly downloads
 
Created
Source

electron-shortcut-normalizer

Normalize electron keyboard shortcuts so they work on different operating systems.

shortcut

  • is a function
  • makes your electron keyboard shortcuts platform-agnostic
  • can make them platform-specific too
  • accepts target platform in an options object
  • converts Option to Alt, because Alt exists on all platforms
  • converts CmdOrCtrl modifier to CommandOrControl
  • supports mixed-case modifiers like MediaPreviousTrack
  • capitalizes first letter of each modifier
  • removes whitespace from shorcuts
  • converts hyphens (-) to plusses (+)

Installation

npm install electron-shortcut-normalizer --save

Usage

const normalize = require("electron-shortcut-normalizer")

normalize('Ctrl+A')
// => 'CommandOrControl+A'

normalize('CommandOrControl+Z', process.platform)
// => 'Command+Z' on Mac OS X
// => 'Control+Z' on Windows and Linux

normalize('CmdOrCtrl+a', 'darwin')
// => 'Command+A'

normalize('CmdOrCtrl+a', 'win32')
// => 'Control+A'

// `Option` is unique to Mac OS X, so it's normalized to `Alt`:
normalize('Option+Up')
// => 'Alt+Up'

For more specific usage information, see test.js

See Also

Tests

npm install
npm test

Dependencies

None

Dev Dependencies

  • tape: tap-producing test harness for node and browsers
  • tap-spec: Formatted TAP output like Mocha's spec reporter

License

MIT

Generated by package-json-to-readme

Keywords

FAQs

Package last updated on 03 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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