From d1473483b2e6c90d257d8252b792c8a69ed919be Mon Sep 17 00:00:00 2001 From: Lukasz Sielski Date: Tue, 26 Apr 2016 11:37:10 +0100 Subject: [PATCH] Support dates --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index c152b5f..50fa549 100644 --- a/index.js +++ b/index.js @@ -30,6 +30,9 @@ // the literal `true`, we always wrap strings in quotes return JSON.stringify(x); } + , "date": function(x) { + return x.toJSON(); + } , "array": function (x) { var output = '' ; @@ -50,10 +53,10 @@ } output += '\n' + indentLevel + '- ' + handler(y); - + }); indentLevel = indentLevel.replace(/ /, ''); - + return output; } , "object": function (x) {