1

I have the following block of borrowed code in one of my JS projects:

return Promise.all(accessoryGetMethods)
.then(systemAccessories => {
  const [partitions, sensors, lights, locks] = systemAccessories
  return {
    id: res.data.id,
    attributes: res.data.attributes,
    partitions: partitions.map(p => p.data),
    sensors: typeof sensors != 'undefined' ? sensors.data : [],
    lights: typeof lights != 'undefined' ? lights.data : [],
    locks: typeof locks != 'undefined' ? locks.data : [],
    relationships: rels
  }
})

In particular, what kind of assignment pattern is the line:

 const [partitions, sensors, lights, locks] = systemAccessories
jonrsharpe
  • 99,167
  • 19
  • 183
  • 334
Mike Kormendy
  • 3,127
  • 1
  • 21
  • 21

0 Answers0