Skip to content

Instantly share code, notes, and snippets.

@bndF1
Last active September 6, 2019 11:24
Show Gist options
  • Save bndF1/a574ee2a63ec7c5ebfde03897da7b9e6 to your computer and use it in GitHub Desktop.
Save bndF1/a574ee2a63ec7c5ebfde03897da7b9e6 to your computer and use it in GitHub Desktop.
Example of Destructuring and object
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);
}
@bndF1
Copy link
Author

bndF1 commented Sep 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment