FIX: do not return config_controls that the pipeline don't have

This commit is contained in:
Gabriel Amorim
2023-02-24 14:31:50 -03:00
parent a9cc951e34
commit 45b82515fc
2 changed files with 35 additions and 14 deletions
+15
View File
@@ -8,3 +8,18 @@ export function getObjValueFromPath<T>(data: { object: T; path: string }): T {
}
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;
}