commands: use Map instead of object

This commit is contained in:
Simon Ser 2024-11-16 12:27:34 +01:00
parent 9c2beac7dd
commit db0a69dcfd
2 changed files with 79 additions and 41 deletions

View file

@ -1583,7 +1583,7 @@ export default class App extends Component {
let name = parts[0].toLowerCase().slice(1);
let args = parts.slice(1);
let cmd = commands[name];
let cmd = commands.get(name);
if (!cmd) {
this.showError(`Unknown command "${name}" (run "/help" to get a command list)`);
return;
@ -1715,7 +1715,7 @@ export default class App extends Component {
}
if (prefix.startsWith("/")) {
let repl = fromList(Object.keys(commands), prefix.slice(1));
let repl = fromList([...commands.keys()], prefix.slice(1));
return repl.map((cmd) => "/" + cmd);
}