Hey guys,
>From an internal conversation, we've received a question, and as a follow
up, the proposal of "take needed props from an object".
Currently if you need to take some properties from an object, you'd do:
```javascript
var foo = {x: bar.x, y: bar.y, z: bar.z};
```
With possible shorthand it even could be (I guess someone proposed this
already at some point):
```javascript
var foo = {bar.x, bar.y, bar.z};
```
Sometimes one could also do with destructuring and shorhands, but these are
two actions
```javascript
var {x, y, z} = bar;
var foo = {x, y, z};
```
And the "take props" operator combine those approaches, and may look like
an import statement from a module, just without the `import` keyword:
```javascript
var foo = {x, y, z} from bar;
```
I personally liked this strawman, it smoothes the border between a module
and an object (which is also a module/namespace, from which we can "import"
needed "exports").
I haven't checked yet the grammar, seems should be fine from the first
glance.
Thoughts?
Dmitry
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss