destructuring.js 656 B

12345678910111213141516171819202122232425262728293031323334
  1. const [one, two = null, three = null] = arr;
  2. a = ([s=1,]) => 1
  3. const { children, ...props } = this.props
  4. const { user: { firstName, lastName } } = this.props;
  5. const {
  6. name: { first, last },
  7. organisation: { address: { street: orgStreetAddress, postcode: orgPostcode } }
  8. } = user;
  9. function f({ data: { name } }) {}
  10. const UserComponent = function({
  11. name: { first, last },
  12. organisation: { address: { street: orgStreetAddress, postcode: orgPostcode } },
  13. }) {
  14. return
  15. };
  16. const { a, b, c, d: { e } } = someObject;
  17. try {
  18. // code
  19. } catch ({ data: { message }}) {
  20. // code
  21. }
  22. try {
  23. // code
  24. } catch ({ data: { message: { errors }}}) {
  25. // code
  26. }