This walk through your multidimensional object composed of sub-objects, arrays and string and apply a custom function
export const iterate = (object, func) => {
const entries = Object.entries(object).map(([key, value]) =>
Array.isArray(value)
? [key, value.map(e => iterate(e, func))]
: typeof value === 'object'
? [key, iterate(value, func)]
: [key, func(value)]
);
return Object.fromEntries(entries);
};
usage:
const r = iterate(data, e=>'converted_'+e);
console.log(r);