import chalk from "chalk";
export function prettyPrintObject(obj, indent = 4) {
    if (typeof obj === "string")
        return chalk.green(JSON.stringify(obj, null, 4));
    else if (typeof obj === "number")
        return chalk.yellow(obj);
    else if (typeof obj === "boolean")
        return chalk.magenta.italic(obj);
    else if (obj === null)
        return chalk.magenta.italic("null");
    else if (obj === undefined)
        return chalk.magenta.italic("undefined");
    else if (obj instanceof Array)
        return [
            chalk.whiteBright("["),
            obj.map(prettyPrintObject)
                .join(chalk.whiteBright(", ")),
            chalk.whiteBright("]")
        ].join("");
    const rows = [];
    for (const key of Object.keys(obj)) {
        const value = obj[key];
        rows.push([
            " ".repeat(indent),
            (JSON.stringify(key)
                .slice(1, -1) === key)
                ? chalk.red(key)
                : chalk.green(JSON.stringify(key)),
            chalk.whiteBright(": "),
            prettyPrintObject(value, indent)
                .replaceAll("\n", "\n" + " ".repeat(indent))
        ].join(""));
    }
    if (rows.length === 0)
        return chalk.whiteBright("{}");
    return chalk.whiteBright("{\n") + rows.join(chalk.whiteBright(",\n")) + chalk.whiteBright("\n") + chalk.whiteBright("}");
}
//# sourceMappingURL=prettyPrintObject.js.map