Last active
April 26, 2019 14:33
-
-
Save bernard-leech/4b94427699436b63c67ac6f2c2d8c4f6 to your computer and use it in GitHub Desktop.
Favoured Object Destructuring Pattern
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
const defaultsMain = { | |
content: { | |
title: 'defaultTitle', | |
description: 'defaultDescription' | |
} | |
} | |
const defaultObj = { main: defaultsMain } | |
const { | |
main: { | |
content: { title } | |
} | |
} = obj || defaultObj |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment