"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.flatten = void 0;
function flatten(data, prefix = '', skipList = [], keyTransformation = (input) => input) {
    let result = {};
    for (const key in data) {
        if (!prefix && skipList.includes(key))
            continue;
        if (typeof data[key] === 'object' && data[key] !== null) {
            const flattened = flatten(data[key], `${prefix}_${key}`, skipList, keyTransformation);
            result = { ...result, ...flattened };
        }
        else {
            result[keyTransformation(`${prefix}_${key}`.replace(/^_/, ''))] = data[key];
        }
    }
    return result;
}
exports.flatten = flatten;
//# sourceMappingURL=flatten.js.map