1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hextris_ynh.git synced 2024-09-03 19:16:05 +02:00
hextris_ynh/sources/vendor/jsonfn.min.js

1 line
809 B
JavaScript
Raw Normal View History

2014-08-18 18:37:19 +02:00
"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)