Permalink
Browse files

Fix issue with nulls. Resolves issue #28

  • Loading branch information...
raycmorgan committed Jun 4, 2012
1 parent d46d9f4 commit c22261d8b634489f8f8fa2058e3ada9d1320686b
Showing with 11 additions and 3 deletions.
  1. +5 −1 lib/mu/renderer.js
  2. +2 −1 test/examples/simple.html
  3. +2 −1 test/examples/simple.js
  4. +2 −0 test/examples/simple.txt
View
@@ -88,7 +88,11 @@ function _render(tokens, context, partials, stream, callback) {
}
function s(val) {
- return typeof val === 'undefined' ? '' : val.toString();
+ if (val === null || typeof val === 'undefined') {
+ return '';
+ } else {
+ return val.toString();
+ }
}
function escape(string) {
@@ -2,4 +2,5 @@
You have just won ${{value}}!
{{#in_ca}}
Well, ${{ taxed_value }}, after taxes.
-{{/in_ca}}
+{{/in_ca}}
+Love, {{owner}}
View
@@ -4,5 +4,6 @@
taxed_value: function () {
return this.value - (this.value * 0.4);
},
- in_ca: true
+ in_ca: true,
+ owner: null
}
View
@@ -2,3 +2,5 @@ Hello Chris
You have just won $10000!
Well, $6000, after taxes.
+
+Love,

0 comments on commit c22261d

Please sign in to comment.