kura
Version:
The FileSystem API abstraction library.
24 lines • 688 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.deepCopy = exports.textToObject = exports.objectToText = void 0;
function objectToText(obj) {
return JSON.stringify(obj);
}
exports.objectToText = objectToText;
function textToObject(text) {
if (!text) {
throw new Error("ObjectUtil#textToObject: No input");
}
try {
return JSON.parse(text);
}
catch (e) {
throw new Error("ObjectUtil#textToObject: " + text + "\n" + text);
}
}
exports.textToObject = textToObject;
function deepCopy(obj) {
return JSON.parse(JSON.stringify(obj));
}
exports.deepCopy = deepCopy;
//# sourceMappingURL=ObjectUtil.js.map