I'm not a big fan of ternary operator, as it makes the code too dense and too much happens on one line, what about extracting this into local variable?