Destructuring is an actively used design pattern. A shorthand assignment method to extract fields from a composite structure.

?Years Old
  • Have a question about Destructuring not answered here? Email me and let me know how I can help.
  • Read more about Destructuring

Languages with Destructuring include javascript, reason

Example from javascript:

const o = {p: 42, q: true};
const {p, q} = o;

Example from reason:

type person = {name: string, age: int};
let somePerson = {name: "Guy", age: 30};
let {name, age} = somePerson;

Last updated February 18th, 2020

Edit Destructuring on GitHub