Created
July 29, 2018 15:30
-
-
Save raulmoyareyes/dea4775182071804ee77c339790ffbc7 to your computer and use it in GitHub Desktop.
Single Responsability Principle
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
class UserAuth { | |
constructor(user) { | |
this.user = user; | |
} | |
verifyCredentials() { | |
// ... | |
} | |
} | |
class UserSettings { | |
constructor(user) { | |
this.user = user; | |
this.auth = new UserAuth(user); | |
} | |
changeSettings(settings) { | |
if (this.auth.verifyCredentials()) { | |
// ... | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment