if (typeof define !== 'function') { var define = require('amdefine')(module) }

define(function() {

  var keyboardEventUtil = {

    PREVENT_DEFAULT_ACTION: 'preventDefault',

    _keyCodeToReadableKeyMap: {
      17: 'Control',
      18: 'Alt',
      91: 'Meta' // Seems not to be correct in FF, but FF supports evt.key
    },

    _mapKeyCodeToReadable: function(keyCode) {
      var keyCodeMap = keyboardEventUtil._keyCodeToReadableKeyMap;
      if (keyCode in keyCodeMap) {
        return keyCodeMap[keyCode];
      }
      return String.fromCharCode(keyCode);
    },

    _getKeyNameFromEvent: function(evt) {
      if (evt.key) {
        if (evt.key.length === 1) { // Ctrl+S in FF reports evt.key='s' (which makes sense) but we handle all just in upper case.
          return evt.key.toUpperCase();
        }
        return evt.key;
      }
      return keyboardEventUtil._mapKeyCodeToReadable(evt.keyCode);
    },

    addKeyDownListener: function(fn) {
      document.addEventListener('keydown', function(evt) {
        var whatToDo = fn(keyboardEventUtil._getKeyNameFromEvent(evt));
        if (whatToDo === keyboardEventUtil.PREVENT_DEFAULT_ACTION) {
          evt.preventDefault();
        }
      });
    },

    addKeyUpListener: function(fn) {
      document.addEventListener('keyup', function(evt) {
        fn(keyboardEventUtil._getKeyNameFromEvent(evt));
      });
    }
  };

  return keyboardEventUtil;
});

@@ -202,16 +202,35 @@
 yMap: %7B%0A
+      16: 'Shift',%0A
       17

Add Shift we missed.