The Existential Operator
dmitry.soshnikov at gmail.com
Mon May 19 20:50:39 PDT 2014
(I remember, I mentioned this couple of years ago, but not sure about
whether it was considered, etc)
Will the "Existential Operator" for properly accessors be something
interesting to consider for ES7 spec? Currently CoffeeScript uses it well.
var street = user.address?.street;
The `street` is either the value of the `user.address.street` if the
`address` property exists (or even if it's an object), or `null` /
This (roughly) to contrast to:
var street = user.address && user.address.street;
(the chain can be longer in many cases).
The same goes with methods:
var score = user.getPlan?().value?.score;
If potentially it could be interesting for ES7, I'll be glad helping with
the proposal, grammar and algorithm (unless it was considered previously,
and decided that it's not for ES for some reason).
P.S.: I tried to solve this issue using default values of destructuring
assignment, but it doesn't help actually.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss