-
-
Save andresmijares/43b9d5db67dd7ea63333b0657e2b9983 to your computer and use it in GitHub Desktop.
This file contains 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
class Gateway { | |
exec (command, ...rest) { | |
if (this[command]) { | |
return this[command].apply(this, rest) | |
} | |
throw Error(`${this.constructor.name} does not have a method called ${command}.`) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment