Skip to content

Instantly share code, notes, and snippets.

@bsommardahl
Created April 8, 2017 20:06
Show Gist options
  • Save bsommardahl/76331410d022e0b313756e776a3eb18a to your computer and use it in GitHub Desktop.
Save bsommardahl/76331410d022e0b313756e776a3eb18a to your computer and use it in GitHub Desktop.
ES6 Desconstruction in Action
describe('When deconstructing an object', () => {
const car = {
color: "red",
size: "large",
doors: [{section: "front", side: "driver"}, {section: "front", side: "passenger"}],
make: "Nissan"
};
it('should be able to deconstruct the object and get only the properties we want', () => {
const {color, size, doors} = car;
expect(color).to.equal("red");
expect(size).to.equal("large");
expect(doors.length).to.equal(2);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment