A way to prevent properties to be added to an object if they are null or undefined.

Jerry Schulteis jdschulteis at yahoo.com
Wed Nov 29 05:29:01 UTC 2017

I was about to hit send on a post also suggesting a helper function, but after thinking about it a bit more, Rodrigo's suggestion resembles extending the optional chaining proposal
into the object literal notation. I suggest using the same character pair, "?.", as is proposed for optional chaining, instead of just "?". 
let ret = {
    bar?.: couldBeNull

The helper function might be best in the case where an empty string value needs the same treatment as null or undefined.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171129/f82c0a25/attachment.html>

More information about the es-discuss mailing list