```JS
var {f: foo} = {f: 5};
foo == 5 // true
```

On Sun, Jun 21, 2015 at 8:50 PM, Salehen Rahman <salehen.rah...@gmail.com>
wrote:

> I know that `import` allows us to alias imports, like so:
>
> ```javascript
> import { f as foo } from 'f';
> ```
>
> But what about object destructuring assignments?
>
> ```javascript
> var { f as foo } = someObject; // Syntax error on Babel
> ```
>
> Either Babel is very late in the game, or the above syntax is actually not
> supported in ECMAScript.
>
> It would be really beneficial to support aliasing for object destructuring.
>
> I find it would make sense since array destructuring assignments allow us
> to assign values to arbitrary variable names.
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to