Serialize JavaScript to a superset of JSON that includes regular expressions and functions.
https://github.com/yahoo/serialize-javascript/compare/v6.0.1...v6.0.2
Full Changelog: https://github.com/yahoo/serialize-javascript/compare/v6.0.0...v6.0.1
Changelog
Behavior changes for URL objects
It serializes URL objects as follows since this version. The result of serialization may be changed if you are passing URL object values into the serialize-javascript.
const serialize = require("serialize-javascript");
serialize({u: new URL("http://example.com/")}); // '{"u":new URL("http://example.com/")}'
Thank you @rrdelaney for this release.
Changelog
Changelog
Behavior changes for sparse arrays
It serializes sparse arrays as follows since this version. The result of serialization may be changed if you are passing sparse arrays values into the serialize-javascript.
const serialize = require('serialize-javascript');
var a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
delete a[0];
a.length = 3;
a[5] = 'wat';
serialize(a) // 'Array.prototype.slice.call({"1":2,"2":3,"5":"wat","length":6})'
Thank you @victorporof for this release.
Changelog
Behavior changes for BigInt
It serializes BigInt
values as follows since this version. The result of serialization may be changed if you are passing BigInt
values into the serialize-javascript.
v4.x:
const serialize = require('serialize-javascript');
serialize({big: BigInt('10')}); // '{"big":BigInt("10")}'
v3.x:
const serialize = require('serialize-javascript');
serialize({big: BigInt('10')}); // throws error
Thank you @mum-never-proud for this release.
Note: the randombytes
has been added to the dependency package to improve the generation of UIDs. Check the #22 for more information. Thanks to @JordanMilne and @Siebes for this change.
Infinity
It serializes Infinity
values as follows since this version. The result of serialization may be changed if you are passing Infinity
values into the serialize-javascript
.
v3.x
const serialize = require('serialize-javascript');
serialize({inf: Infinity}); // '{"inf":Infinity}'
v2.x
const serialize = require('serialize-javascript');
serialize({inf: Infinity}); // '{"inf":null}'