mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
15 lines
336 B
TypeScript
15 lines
336 B
TypeScript
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
|
|
/**
|
|
* Get a deeply nested value based on a given path string
|
|
*
|
|
* @param object
|
|
* @param path
|
|
* @returns {T}
|
|
*/
|
|
export function getValueByPath<T = any>(object: any, path: string): T {
|
|
return path.split('.').reduce((acc, part) => {
|
|
return acc && acc[part];
|
|
}, object);
|
|
}
|