Skip to content

Corrected handling of "falsey" values.

Compare
Choose a tag to compare
@atheken atheken released this 22 Jan 14:55
· 51 commits to master since this release

With Mustachio, we tried to follow the specification of Mustache.js as closely as possible.

This included "flow control" through the existence or absence of "falsey" values (as defined by JS) -- null, false, 0 as well as empty arrays ([]).

However, we made a mistake in our understanding of how Mustache is defined. Mustache uses falsey values to control the flow of the template, but also, will print those values if they are included in a template. For example, this Mustache template:

{{ a_false_value }}

Would result in the string:

"false"

Mustachio had a bug where falsey values would not be printed, so the above template would result in an empty string instead of "false".

This release resolves this issue, so that Mustachio behaves the same way as Mustache when printing falsey values.