@tryforge/forgescript
Version:
ForgeScript is a comprehensive package that empowers you to effortlessly interact with Discord's API. It ensures scripting remains easy to learn and consistently effective.
18 lines • 544 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.JSONNumberRegex = exports.JSONEndRegex = exports.JSONStartRegex = void 0;
exports.JSONStartRegex = /^[[{]/;
exports.JSONEndRegex = /^[\]}]/;
exports.JSONNumberRegex = /^\d+$/;
function parseJSON(str) {
if (typeof str !== "string")
return str;
try {
return exports.JSONNumberRegex.test(str) ? str : JSON.parse(str);
}
catch (error) {
return str;
}
}
exports.default = parseJSON;
//# sourceMappingURL=parseJSON.js.map
;