You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
use existing command hashmap over linear array search
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -44,9 +44,9 @@ export default class CommandProvider extends AutocompleteProvider {
|
|||||||
let matches = [];
|
let matches = [];
|
||||||
if (command[0] !== command[1]) {
|
if (command[0] !== command[1]) {
|
||||||
// The input looks like a command with arguments, perform exact match
|
// The input looks like a command with arguments, perform exact match
|
||||||
const match = COMMANDS.find((o) => o.command === command[1]);
|
const name = command[1].substr(1); // strip leading `/`
|
||||||
if (match) {
|
if (CommandMap[name]) {
|
||||||
matches = [match];
|
matches = [CommandMap[name]];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (query === '/') {
|
if (query === '/') {
|
||||||
|
|||||||
Reference in New Issue
Block a user