Destructuring an object into a new object (like Underscore pick but ESier)

Bergi a.d.bergi at
Sun Feb 21 23:41:17 UTC 2016

Zacqary Adam Xeper wrote:

> But if I want to initialize a new object that pulls in just the foo and bar
> properties, I have to type this whole structure out:
> let newObj = {foo:, bar:, quux: 4}
> Or, if I want to use shorthand property names, I can use a destructuring
> statement, but then I have to type all the property names twice:
> let {foo, bar} = obj;
> let newObj = {foo, bar, quux: 4};

I would suggest that we also allow property references, not only 
variable identifiers in shorthand property notation:

let newObj = {,, quux: 4};

What do you think?


More information about the es-discuss mailing list