loading...

re: The shortest way to conditional insert properties into an object literal VIEW POST

FULL DISCUSSION
 

Personally, I would do it like ...(obj && { props: foo}) so it is obvious how the operators work, people who don't immediately know that && has precedence over ...won't read the code as easily.

Code of Conduct Report abuse