diff options
| author | Sean Fridman <fridman@mail.sfsu.edu> | 2015-04-09 21:51:42 -0400 |
|---|---|---|
| committer | Sean Fridman <fridman@mail.sfsu.edu> | 2015-04-09 21:51:42 -0400 |
| commit | cbfe80f1f5adb69ed95ec7c7f8c3a15ac9575386 (patch) | |
| tree | 4eee1544274be93c7e89083f7a1673f05c96e2d5 /app/node_modules/oktemplate/index.js | |
| parent | 005bab899ab3badc7796e00a2bff90e3be1209d1 (diff) | |
Differentiate strignify and prettify template tags
Diffstat (limited to 'app/node_modules/oktemplate/index.js')
| -rw-r--r-- | app/node_modules/oktemplate/index.js | 15 |
1 files 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 '<pre>' + stringify(obj) + '</pre>'; } 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'; } - } + }, }; |
