svcorelib
Version:
Core library used in the projects of Sv443 and the Sv443 Network. Contains tons of miscellaneous QoL features.
22 lines (17 loc) • 382 B
JavaScript
function reserialize(obj, immutable)
{
if(typeof obj != "object")
return obj;
try
{
let reserialized = JSON.parse(JSON.stringify(obj));
if(immutable === true)
return Object.freeze(reserialized);
return reserialized;
}
catch(err)
{
return obj;
}
}
module.exports = reserialize;