Releases: yahoo/serialize-javascript
Releases · yahoo/serialize-javascript
v2.1.0
v2.0.0
Behavior changes for undefined
It serializes undefined
values as follows since this version. The result of serialization may be changed if you are passing undefined
values into the serialize-javascript
.
v2.x
const serialize = require('serialize-javascript');
serialize({undef: undefined}); // '{"undef":undefined}'
v1.x
const serialize = require('serialize-javascript');
serialize({undef: undefined}); // '{}'
v1.9.1
v1.9.0
v1.8.0
v1.7.0
v1.6.1
v1.6.0
v1.4.0
Improve Perf of Pure JSON Data
This minor release drastically improves the perf of serializing pure JSON data with the new {isJSON: true}
flag. #17
Passing a replacer
function to JSON.stringify()
slows it down dramatically. If possible, we should avoid this this path, and the new isJSON
option is the signal that the object passed-in contains no functions or regexp values. But still protect against XSS by properly escaping for a <script>
context.
Node v0.12.10
simpleObj:
JSON.stringify( simpleObj ) x 1,303,349 ops/sec ±0.66% (99 runs sampled)
JSON.stringify( simpleObj ) with replacer x 386,634 ops/sec ±0.72% (96 runs sampled)
serialize( simpleObj ) x 284,535 ops/sec ±0.92% (98 runs sampled)
serialize( simpleObj, {isJSON: true} ) x 951,798 ops/sec ±0.92% (96 runs sampled)