Added all mediaInfo to mpris interface using the prefix

This commit is contained in:
2024-06-09 16:16:25 +02:00
parent 28a9458dfc
commit 54316d31b5
3 changed files with 16 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
// 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;
};