Con 1379 handlebars engine

Can we somehow decrease code repetition in this method? We're introducing 3rd almost identical if block here.
Do you think that it's possible to use Command Pattern to make this code more clear?