Re%3A A way to prevent properties to be added to an object if they are null or undefined.&In-Reply-To=<>

Rodrigo Carranza rodrigocarranza at
Wed Nov 29 03:13:41 UTC 2017

Yeah, it was wrong, I'm currently using like

let ret = { ... ( couldBeNull ? {couldBeNull} : {} ) }

Yours is better and the usual idiom a bit hard to understand.

What I'm proposing is something like this

let ret = { couldBeNull? }
or if you want a different name for the property

let ret = { bar ?: couldBeNull }

It is not like there is no way to do this, there are plenty. But this way could make code a bit easier to read.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list