I define an array like this:
[{foo:0}, true === false && { foobar:1}, {bar:2}]
My expected result would be that the middle item is not added at all when the middle condition is not met:
[ { foo: 0 }, { bar: 2 } ]
in fact it adds false as an array item:
[ { foo: 0 }, false, { bar: 2 } ]
Is there a way to prevent adding the false while maintaining this lightweight syntax (I know I could always use push or the spread operator)
filterafter:[{foo:0}, true === false && { foobar:1}, {bar:2}].filter(Boolean)condition ? { foobar:1} : nulland filter outnullvalues at the end.