"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.flat = flat;
function flat(data, prefix = '') {
    let result = {};
    for (const key in data) {
        if (typeof data[key] == 'object' && data[key] !== null) {
            const flatten = flat(data[key], prefix + '.' + key);
            result = { ...result, ...flatten };
        }
        else {
            const stringifiedValue = stringify(data[key]);
            result[(prefix + '.' + key).replace(/^\./, '')] = stringifiedValue;
        }
    }
    return result;
}
function stringify(value) {
    if (typeof value === 'string') {
        return value;
    }
    if (typeof value === 'number' || typeof value === 'boolean') {
        return value.toString();
    }
    return JSON.stringify(value);
}
//# sourceMappingURL=flat.js.map