various improvements for shopping line item dialog

This commit is contained in:
vabene1111
2024-10-23 18:23:48 +02:00
parent 4692526e48
commit 77748a951b
37 changed files with 192 additions and 43 deletions

18
vue3/src/utils/utils.ts Normal file
View File

@@ -0,0 +1,18 @@
/**
* Gets a nested property of an object given a dot-notation path.
*
* @param object The object to access the property from.
* @param path The dot-notation path to the property.
* @returns The value of the nested property, or `undefined` if not found.
*/
export function getNestedProperty(object: any, path: string): any {
const pathParts = path.split('.');
return pathParts.reduce((obj, key) => {
if (obj && typeof obj === 'object') {
return obj[key]
} else {
return undefined;
}
}, object);
}