title: ES6 Object Destructuring Default Values for Nested Parameters
body: <p>I'm using es6 object destructuring to provide default parameters to a function.</p>
  
  <pre><code>function mapStateToProps({ shops: { cakeShop: {}, pieShop: {} }) {
    return {
      CakeShopName: shops.cakeShop.Name,
      PieShopName: shops.pieShop.Name
    }
  }
  </code></pre>
  
  <p>The problem with the above is that if I call</p>
  
  <pre><code>mapStateToProps({})
  </code></pre>
  
  <p>The code throws <code>Cannot read property 'Name' of undefined</code>. The nested objects on <code>shops</code> are not set to their default values and the code has a null reference.</p>
  
  <p>How can I make sure that the nested objects within <code>shops</code> are being set to the right default value, even if <code>shops</code> itself is defined?</p>