Last active
September 6, 2019 11:24
-
-
Save bndF1/a574ee2a63ec7c5ebfde03897da7b9e6 to your computer and use it in GitHub Desktop.
Example of Destructuring and object
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
routes: MyBeatifulInterface; | |
private destructExtrangeObject() { | |
let returnBackURL: string; | |
if (this.someValue) { | |
returnBackURL = 'some-url' + this.someValue | |
} else if (!this.someValue && !this.anotherValue) { | |
returnBackURL = '/another-url'; | |
} else if (this.anotherValue) { | |
returnBackURL = '/different/url' + this.anotherValue; | |
} | |
({ returnBackURL, cancelRouteURL: this.cancelRoute } = this.routes); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source https://codeburst.io/es6-destructuring-the-complete-guide-7f842d08b98f