handlebars.java
handlebars.java copied to clipboard
StringHelpers.apply causes unexpected behavior
If the context is falsy, apply will return the value of the first param. This seems to be unexpected?
For instance, {{abbreviate foo 5}} will render 5 if foo is undefined. I would expect to it render `` (the empty string) or perhaps even throw an exception, but certainly wouldn't expect 5.
Not sure if the abbreviate helper should maybe override apply instead of safeApply and treat context as an empty string if it's falsy? Either way, doesn't seem like desired behavior to render the first param if the context is falsy.