samedi 27 juillet 2019

Destructure a deeply nested object with one of its parents being an array in Javascript in one line

I have an object I'd like to destructure in one line a nested object that has an array as a parent. Given the below object, can this even be destructured in one line?

const deepObj = {
  allInformation: {
    edges: [
      {
        node: {
          address: 'Never Never Land',
          email: 'daffyduck@neverneverland',
          phoneNumber: '146 246'
        }
      }
    ]
  }
}

// one liner object destructuring in function signature?? 
const oneLiner = (deepObj) => (...)

The goal is to access the address, email and phoneNumber variables within the function signature.




Aucun commentaire:

Enregistrer un commentaire