function flattenObject(obj, parentKey = '') {
    return Object.entries(obj).reduce((acc, [key, value])=>{
        const currentKey = parentKey ? `${parentKey}${key ? '-' + key : ''}` : key;
        if (typeof value === 'object' && !Array.isArray(value)) {
            Object.assign(acc, flattenObject(value, currentKey));
        } else {
            acc[currentKey] = value;
        }
        return acc;
    }, {});
}

export { flattenObject };
