We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently, the command are called with chained if-else blocks like this:
if (message === 'command 1') { http.get({ hostname: config.apiHost, port: config.apiPort, path: 'api/path/1' }, sendMeme); } else if (message === 'command 2') { http.get({ hostname: config.apiHost, port: config.apiPort, path: 'api/path/2' }, sendMeme); } else ...
This is terrible, because:
Ideally, after this refactoring, the above code would look like this:
commandMap = { 'command 1': { 'path': 'api/path/1', 'help': 'This command do thing 1' }, 'command 2': { 'path': 'api/path/2', 'help': 'This command do thing 2' }; addMemeCommand(commandMap);
This will makes it easier to add a command. Moreover, it has low time complexity O(1) and it is also easier to implement a solution for #6
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Currently, the command are called with chained if-else blocks like this:
This is terrible, because:
Ideally, after this refactoring, the above code would look like this:
This will makes it easier to add a command. Moreover, it has low time complexity O(1) and it is also easier to implement a solution for #6
The text was updated successfully, but these errors were encountered: