github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/helpers/clean-keycommand.js (about)

     1  // @ts-check
     2  import { helper } from '@ember/component/helper';
     3  
     4  const KEY_ALIAS_MAP = {
     5    ArrowRight: '→',
     6    ArrowLeft: '←',
     7    ArrowUp: '↑',
     8    ArrowDown: '↓',
     9    '+': ' + ',
    10  };
    11  
    12  export default helper(function cleanKeycommand([key] /*, named*/) {
    13    let cleaned = key;
    14    Object.keys(KEY_ALIAS_MAP).forEach((k) => {
    15      cleaned = cleaned.replace(k, KEY_ALIAS_MAP[k]);
    16    });
    17    return cleaned;
    18  });