Validate and standardize exposure of command classes#18
Merged
gigabo merged 3 commits intoasini:masterfrom Sep 23, 2016
Merged
Conversation
Groundwork for pluggable commands. Ensure that command classes: - Are named `*Command` - Are uniquely named - Extend the `Command` base class
rygine
reviewed
Sep 21, 2016
| } | ||
|
|
||
| export function commandNameFromClassName(className) { | ||
| return className.replace("Command", "").toLowerCase(); |
Contributor
There was a problem hiding this comment.
what happens if we have CommandCommand? 😄
return className.replace(/Command$/, '').toLowerCase();?
Contributor
Author
There was a problem hiding this comment.
Good call. Will update.
rygine
reviewed
Sep 21, 2016
| return className.replace("Command", "").toLowerCase(); | ||
| } | ||
|
|
||
| export function exposeCommands(obj, commands) { |
Contributor
There was a problem hiding this comment.
what if instead of mutating the argument, we just return the exposed commands?
Contributor
Author
There was a problem hiding this comment.
Yeah, that's probably nicer for now. I had been anticipating a plugin API that added commands after-the-fact, but we can always change the API here if we need to for that.
Contributor
Author
|
I think I've addressed all of the feedback here. Will merge this afternoon barring objections. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Groundwork for pluggable commands.
Ensure that command classes:
*CommandCommandbase class