mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-10 19:29:08 +00:00
Merge branch 'main' into feat/google-sheets-link
This commit is contained in:
@@ -11,3 +11,18 @@ export function getObjValueFromPath<T extends object>(data: {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
export function objHasPath<T extends object>(data: {
|
||||
object: T;
|
||||
path: string;
|
||||
}): boolean {
|
||||
const { object, path } = data;
|
||||
const keys = path.split('.');
|
||||
|
||||
let value = JSON.parse(JSON.stringify(object));
|
||||
for (const key of keys) {
|
||||
if (!(key in value)) return false;
|
||||
value = value[key];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user