Currently, inline if expressions are compiled to return an empty string in the absence of an else.
Jinja's templating documentation specifies that an inline if expression should return an Undefined object.
For parity with Jinja, seems Nunjucks inline ifs should also evaluate to undefined in the absence of an else. Both '' and undefined are falsy, but some code may require to differenciate between undefined (no value was given) and '' (an empty string was given). Such code gets easily broken if called with <SOMETHING> if <CONDITION> as you'd expect undefined but get ''.
Currently, inline
ifexpressions are compiled to return an empty string in the absence of anelse.Jinja's templating documentation specifies that an inline
ifexpression should return an Undefined object.For parity with Jinja, seems Nunjucks inline
ifs should also evaluate toundefinedin the absence of anelse. Both''andundefinedare falsy, but some code may require to differenciate betweenundefined(no value was given) and''(an empty string was given). Such code gets easily broken if called with<SOMETHING> if <CONDITION>as you'd expectundefinedbut get''.