{"size": 531, "ext": "js", "max_stars_repo_path": "lib/utils/createShortcut.js", "max_stars_repo_name": "andrepolischuk/pomodoro", "max_stars_repo_stars_event_min_datetime": "2017-11-12T00:40:32.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T06:33:15.000Z", "max_issues_repo_path": "lib/utils/createShortcut.js", "max_issues_repo_name": "andrepolischuk/pomodoro", "max_issues_repo_issues_event_min_datetime": "2017-05-31T15:51:40.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-06T20:25:55.000Z", "max_forks_repo_path": "lib/utils/createShortcut.js", "max_forks_repo_name": "andrepolischuk/tom", "max_forks_repo_forks_event_min_datetime": "2017-12-10T22:25:07.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-22T08:47:16.000Z"}
{"max_stars_count": 140, "max_issues_count": 16, "max_forks_count": 26, "avg_line_length": 20.4230769231, "max_line_length": 80, "alphanum_fraction": 0.6233521657}
'use strict'
const modifierKeys = require('./modifierKeys')

module.exports = function createShortcut (event, value) {
  const isModifier =
    event.keyCode === 91 || (event.keyCode > 15 && event.keyCode < 19)

  event.preventDefault()

  if (isModifier) {
    return value
  }

  const keys = []

  Object.entries(modifierKeys).forEach(([key, m]) => {
    if (event[m.key]) {
      keys.push(key)
    }
  })

  const key = event.code.indexOf('Key') === 0 ? event.code.substr(3) : event.key

  return keys.concat(key).join('+')
}
