Pipe expression

Artem Kobzar a.kobzar.nlt at gmail.com
Mon Nov 18 15:44:05 UTC 2019


When we need to me destruction from array or object and change value then
we need make something like this

```js
let { first, second } = getSomeObject();
first = computeFirst(first);

// Or create temporary useless variable

const obj = getSomeObject();
const second = obj.second;
const first = computeFirst(obj.first);
```

I propose to make operator which will give ability to us to apply some
function to property inside destruction-syntax without mutable or temporary
variables

```js
const { first | computeFirst, second } = getSomeObject();
```

I think that syntax should be discussed, but it seems lie pipe-symbol is
well-known operator in bash and in AngularJS/Vue community.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20191118/b912be58/attachment.html>


More information about the es-discuss mailing list