Skip to content

Commit 7d34ba7

Browse files
author
Alex Wilson
committed
{{{foo}}} when foo is a plain JS object should return JSON
1 parent 7e340e9 commit 7d34ba7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/template.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ var Hogan = {};
319319
hChars = /[&<>\"\']/;
320320

321321
function coerceToString(val) {
322+
if (typeof (val) === 'object' && val.toString === Object.prototype.toString)
323+
return (JSON.stringify(val));
322324
return String((val === null || val === undefined) ? '' : val);
323325
}
324326

0 commit comments

Comments
 (0)