@darwish/utils-core
Version:
20 lines (19 loc) • 421 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.jsonParse = exports.jsonStr = void 0;
function jsonStr(obj) {
return JSON.stringify(obj, null, 2);
}
exports.jsonStr = jsonStr;
function jsonParse(str) {
var ans = null;
try {
JSON.parse(str);
}
catch (e) {
console.error(e);
ans = null;
}
return ans;
}
exports.jsonParse = jsonParse;