Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
More null fixes for Mustache
Browse files Browse the repository at this point in the history
  • Loading branch information
kfay authored and Isao Yagi committed Jul 18, 2012
1 parent 7adda35 commit 03c48a4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions source/lib/app/libs/Mulib/Mu.js
Expand Up @@ -147,7 +147,7 @@ Mu.normalize = function Mu_normalize(context, name) {
val = val.call(context);
}

return typeof val === 'undefined' ? '' : val.toString();
return (null === val || typeof val === 'undefined') ? '' : val.toString();
}

/**
Expand All @@ -170,7 +170,7 @@ Mu.enumerable = function Mu_enumerable(context, val, fn) {
val = val.call(context);
}

if (typeof val === 'undefined') {
if (null === val || typeof val === 'undefined') {
return '';
}

Expand All @@ -181,9 +181,7 @@ Mu.enumerable = function Mu_enumerable(context, val, fn) {
if (val instanceof Array) {
var result = '';
for (var i = 0, len = val.length; i < len; i++) {
var oproto = insertProto(val[i], context);
result += fn(val[i]);
oproto.__proto__ = baseProto;
result += Mu.enumerable(context, val[i], fn);
}
return result;
}
Expand Down

0 comments on commit 03c48a4

Please sign in to comment.