Herby Vojčík wrote:
Maybe allowing
let {b, b:{x,y}} = obj;
would be enough. It sort-of comforms to existing syntax as well as
semantics.
That looks like a mistake. ES5 strict mode and so 1JS wants duplicate
property names in object literals to be errors, so I expect the same for
duplicate property names in destructuring patterns. Claus's 'as' syntax
avoids that problem and could even be shortened:
let { b as {x,y} } = obj
to bind b, x, and y, instead of what was in the o.p.:
let { b: b as {x,y} } = obj
DRY and EIBTI argue for 'as' and the shorter shorthand.
/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss