Is this: `return a && (b && a + ' ' + operator + ' ' + b || a ) || b` what you wanted to say?
If somebody has more readable version it is more than welcome.