|
|
@@ -286,10 +286,9 @@ var Mustache; |
|
|
Renderer.prototype._inverted = function (name, context, callback) { |
|
|
Renderer.prototype._inverted = function (name, context, callback) { |
|
|
var value = context.lookup(name); |
|
|
var value = context.lookup(name); |
|
|
|
|
|
|
|
|
// From the spec: inverted sections may render text once based on the |
|
|
|
|
|
// inverse value of the key. That is, they will be rendered if the key |
|
|
|
|
|
// doesn't exist, is false, or is an empty list. |
|
|
|
|
|
if (value == null || value === false || (isArray(value) && value.length === 0)) { |
|
|
|
|
|
|
|
|
// Use JavaScript's definition of falsy. Include empty arrays. |
|
|
|
|
|
// See https://github.com/janl/mustache.js/issues/186 |
|
|
|
|
|
if (!value || (isArray(value) && value.length === 0)) { |
|
|
return callback(context, this); |
|
|
return callback(context, this); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|