stringify-object
Advanced tools
Comparing version 0.1.5 to 0.1.6
{ | ||
"name": "stringify-object", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Stringify an object/array like JSON.stringify just without all the double-quotes", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -34,3 +34,2 @@ /*global window */ | ||
opts.indent = opts.indent || '\t'; | ||
opts.quote = opts.singleQuotes === false ? '"' : '\''; | ||
pad = pad || ''; | ||
@@ -76,6 +75,7 @@ | ||
return opts.quote + val.replace( | ||
opts.singleQuotes ? /'/g : /"/g, | ||
opts.singleQuotes ? '\\\"' : '\\\'' | ||
) + opts.quote; | ||
if (opts.singleQuotes === false) { | ||
return '"' + val.replace(/"/g, '\\\"') + '"'; | ||
} else { | ||
return "'" + val.replace(/'/g, "\\\'") + "'"; | ||
} | ||
})(val, opts, pad); | ||
@@ -82,0 +82,0 @@ } |
4892