"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAbsoluteTypes = exports.safeParse = void 0;
const safeParse = (data, option = {
    backup: {},
}) => {
    const { backup, onErr } = option;
    let res = backup;
    try {
        res = JSON.parse(data);
    }
    catch (e) {
        if (onErr) {
            onErr(e);
        }
        else {
            console.error(e);
        }
    }
    return res;
};
exports.safeParse = safeParse;
const getAbsoluteTypes = (o) => {
    return Object.prototype.toString.call(o).slice(8, -1).toLocaleLowerCase();
};
exports.getAbsoluteTypes = getAbsoluteTypes;
