janl/mustache.js — Issue #157: false vs. null bug
Author: philfreo
Created: 2012-01-23 19:26:15+00:00
State: open

There's a bug where `null` is not treated the same as `false` when it comes to deciding if a template should be shown, per the docs.

```

Test: {{ foo }}
{{ #bar }}*{{ bar }}*{{ /bar }}

```

data source:

```
TESTING_DATA = [
{
'foo': 'foo1',
'bar': null
},
{
'foo': 'foo2',
'bar': false,
},
{
'foo': 'foo3',
'bar': 'bar1'
}
];
```

Gets rendered as:

```
Test: foo1 **
Test: foo2
Test: foo3 *bar1*
```

Instead of the expected:

```
Test: foo1
Test: foo2
Test: foo3 *bar1*
```

Specifically the mustache.js docs say "If the person key exists and has a value of null, undefined, or false, or is an empty list, the block will not be rendered." but it seems that `null` is not being treated correctly like `false` is.