Get currently destructured object

Isiah Meadows isiahmeadows at gmail.com
Thu May 19 19:47:07 UTC 2016


How is it any different than this, to borrow your first example:

```js
function foo(baz) {
    const {bar} = baz
    // do things
}
```

On Thu, May 19, 2016, 11:59 Michał Wadas <michalwadas at gmail.com> wrote:

> Idea:
>
> function foo({bar, *: baz}) {
>
> }
>
> would be equivalent to:
>
> function foo(baz) {
>    const bar =  baz.bar;
> }
>
> Rationales:
> - little better IDE support (argument name reveals intention)
> - allows to write more concise code when handling case of getting common
> values and handling whole object optionally
> - improve pattern "use few properties of options object then pass it
> deeper"
> - allows more expressive module import
> - allows to more concise code when destructuring expression result
>
> import {*: rand, generateRandomInt} from 'fancy-random-module';
> import {*: moment, isMoment} from 'moment';
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160519/41f6876e/attachment.html>


More information about the es-discuss mailing list