mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2025-04-19 11:12:30 +02:00
14 lines
469 B
TypeScript
14 lines
469 B
TypeScript
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
export const ObjectToDotNotation = (obj: any, prefix: string = "", target: any = {}) => {
|
|
Object.keys(obj).forEach((key: string) => {
|
|
if (typeof obj[key] === "object" && obj[key] !== null) {
|
|
ObjectToDotNotation(obj[key], prefix + key + ".", target);
|
|
} else {
|
|
const dotLocation = prefix + key;
|
|
target[dotLocation] = obj[key];
|
|
return target;
|
|
}
|
|
});
|
|
return target;
|
|
};
|