mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-14 18:34:48 +00:00
11 lines
293 B
TypeScript
11 lines
293 B
TypeScript
export function getObjValueFromPath<T>(data: { object: T; path: string }): T {
|
|
const { object, path } = data;
|
|
const keys = path.split('.');
|
|
|
|
let value = JSON.parse(JSON.stringify(object));
|
|
for (const key of keys) {
|
|
if (value != undefined) value = value[key];
|
|
}
|
|
return value;
|
|
}
|