github.com/hernad/nomad@v1.6.112/ui/app/helpers/clean-keycommand.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 // @ts-check 7 import { helper } from '@ember/component/helper'; 8 9 const KEY_ALIAS_MAP = { 10 ArrowRight: '→', 11 ArrowLeft: '←', 12 ArrowUp: '↑', 13 ArrowDown: '↓', 14 '+': ' + ', 15 }; 16 17 export default helper(function cleanKeycommand([key] /*, named*/) { 18 let cleaned = key; 19 Object.keys(KEY_ALIAS_MAP).forEach((k) => { 20 cleaned = cleaned.replace(k, KEY_ALIAS_MAP[k]); 21 }); 22 return cleaned; 23 });