Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pn.json.parseJson = function(json) {
if (!json) return null;
pn.assStr(json);
var regex = /\"[\\]+\/Date\((-?\d+(\+\d+)?)\)[\\]+\/\"/g;
if (!window['pn.date.fromMillis'])
window['pn.date.fromMillis'] = pn.date.fromMillis;
var jsonDateSafe = json.replace(regex, 'window["pn.date.fromMillis"]($1)');
return /** @type {!Object} */ (goog.json.unsafeParse(jsonDateSafe));
};
pn.json.parseJson = function(json) {
if (!json) return null;
pn.assStr(json);
var regex = /\"[\\]+\/Date\((-?\d+(\+\d+)?)\)[\\]+\/\"/g;
if (!window['pn.date.fromMillis'])
window['pn.date.fromMillis'] = pn.date.fromMillis;
var jsonDateSafe = json.replace(regex, 'window["pn.date.fromMillis"]($1)');
return /** @type {!Object} */ (goog.json.unsafeParse(jsonDateSafe));
};