UNPKG

diginext-utils

Version:
32 lines 749 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isValid = void 0; /** * Check if the object or string is in JSON format */ const isValid = (content) => { if (typeof content == "object") { try { content = JSON.stringify(content); } catch (err) { return false; } } if (typeof content == "string") { try { content = JSON.parse(content); } catch (err) { return false; } } if (typeof content != "object") { return false; } return true; }; exports.isValid = isValid; const xjson = { isValid: exports.isValid }; exports.default = xjson; //# sourceMappingURL=json.js.map