"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatForJSONOutput = formatForJSONOutput;
const util_1 = require("util");
const bson_1 = require("bson");
function formatForJSONOutput(value, mode) {
    if (util_1.types.isNativeError(value)) {
        value = {
            ...value,
            message: value.message,
            stack: value.stack,
            name: value.name,
        };
    }
    return bson_1.EJSON.stringify(value, undefined, 2, {
        relaxed: mode === 'relaxed',
    });
}
//# sourceMappingURL=format-json.js.map