"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeEmptyValues = removeEmptyValues;
exports.toYaml = toYaml;
const js_yaml_1 = require("js-yaml");
function removeEmptyValues(obj) {
    if (Array.isArray(obj)) {
        return obj.map(removeEmptyValues);
    }
    if (obj && typeof obj === 'object') {
        const result = {};
        for (const [key, value] of Object.entries(obj)) {
            if (value !== undefined && value !== null) {
                result[key] = removeEmptyValues(value);
            }
        }
        return result;
    }
    return obj;
}
function toYaml(obj) {
    const cleanObj = removeEmptyValues(obj);
    return (0, js_yaml_1.dump)(cleanObj, {
        indent: 2,
        lineWidth: -1,
        noRefs: true,
        sortKeys: false,
    }).trim();
}
