Comparing version 0.0.3 to 0.0.4
0.0.4 / 2016-01-22 | ||
================== | ||
* improve for undefined values and literals | ||
0.0.3 / 2014-12-30 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -31,5 +31,9 @@ /** | ||
var stringify = exports.stringify = function (obj, replacer, space) { | ||
return json.stringify(obj, function(k, v) { | ||
var str = json.stringify(obj, function(k, v) { | ||
return replacer ? replacer(k, coerce(k, v)) : coerce(k, v); | ||
}, space); | ||
return str[0] === '"' && str[str.length - 1] === '"' | ||
? str.slice(1, -1) | ||
: str | ||
} | ||
@@ -67,2 +71,3 @@ | ||
case 'function': return v.toString(); | ||
case 'undefined': return 'undefined'; | ||
default: return v; | ||
@@ -83,2 +88,3 @@ } | ||
if (rdate.test(v)) return stod(v); | ||
if ('undefined' === v) return undefined; | ||
if ('/' == v[0] && rregexp.test(v)) return stor(v); | ||
@@ -85,0 +91,0 @@ if ('function' == v.slice(0, 8) && '}' == v[v.length - 1] && isfn(v)) return stof(v); |
{ | ||
"name": "superjson", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "extends JSON.stringify and JSON.parse to support additional JS types (Dates, RegExps, Functions, etc.)", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
6831
7
161