From cbfe80f1f5adb69ed95ec7c7f8c3a15ac9575386 Mon Sep 17 00:00:00 2001 From: Sean Fridman Date: Thu, 9 Apr 2015 21:51:42 -0400 Subject: Differentiate strignify and prettify template tags --- app/node_modules/oktemplate/index.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/node_modules/oktemplate/index.js b/app/node_modules/oktemplate/index.js index a37f78e..f2c2e07 100644 --- a/app/node_modules/oktemplate/index.js +++ b/app/node_modules/oktemplate/index.js @@ -14,13 +14,24 @@ var filters = { * Return a string formatted version of a JSON object. * Useful for quick debugging of template data. */ - stringify: function(obj) { + prettify: function(obj) { try { return '
' + stringify(obj) + '
'; + } catch (e) { + return 'Error prettifying'; + } + }, + + /** + * Serialize Javascript objects into a JSON string + */ + stringify: function(obj) { + try { + return JSON.stringify(obj); } catch (e) { return 'Error stringifying'; } - } + }, }; -- cgit v1.2.3-70-g09d2