@resk/core
Version:
An innovative TypeScript framework that empowers developers to build applications with a fully decorator-based architecture for efficient resource management. By combining the power of decorators with a resource-oriented design, DecorRes enhances code cla
1 lines • 808 B
JavaScript
;var i=class n{static decycle(e,t=[]){if(typeof e=="function")return;if(!e||typeof e!="object")return e;if(t.includes(e))return null;let r=t.concat([e]);return Array.isArray(e)?e.map(a=>n.decycle(a,r)):Object.fromEntries(Object.entries(e).map(([a,c])=>[a,n.decycle(c,r)]))}static stringify(e,t=false){return typeof e=="string"?e:JSON.stringify(t!==false?n.decycle(e):e)}static isJSON(e){if(typeof e!="string")return false;let t=e.trim();if(t.length===0)return false;let r=t[0];if(r!=="{"&&r!=="[")return false;try{let a=JSON.parse(t);return a!==null&&typeof a=="object"}catch(a){return false}}static parse(e,t){if(typeof e=="string")try{e=JSON.parse(e,t);}catch(r){return e}if(e&&typeof e=="object")for(let r in e){let a=e[r];n.isJSON(a)&&(e[r]=n.parse(a,t));}return e}};exports.JsonHelper=i;