hextris/vendor_v6/jsonfn.min.js
2014-08-21 23:13:35 -04:00

1 line
No EOL
809 B
JavaScript

"use strict";(function(exports){exports.stringify=function(e){return JSON.stringify(e,function(e,t){if(t instanceof Function||typeof t=="function"){return t.toString()}if(t instanceof RegExp){return"_PxEgEr_"+t}return t})};exports.parse=function(str,date2obj){var iso8061=date2obj?/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/:false;return JSON.parse(str,function(key,value){var prefix;if(typeof value!="string"){return value}if(value.length<8){return value}prefix=value.substring(0,8);if(iso8061&&value.match(iso8061)){return new Date(value)}if(prefix==="function"){return eval("("+value+")")}if(prefix==="_PxEgEr_"){return eval(value.slice(8))}return value})};exports.clone=function(e,t){return exports.parse(exports.stringify(e),t)}})(typeof exports==="undefined"?window.JSONfn={}:exports)