🐛 Fix issue with credentials which extend others

This commit is contained in:
Jan Oberhauser
2020-05-16 19:05:40 +02:00
parent 97cf7da6c3
commit 95097a8bd7
5 changed files with 131 additions and 36 deletions

View File

@@ -1093,3 +1093,27 @@ export function mergeIssues(destination: INodeIssues, source: INodeIssues | null
destination.typeUnknown = true;
}
}
/**
* Merges the given node properties
*
* @export
* @param {INodeProperties[]} mainProperties
* @param {INodeProperties[]} addProperties
*/
export function mergeNodeProperties(mainProperties: INodeProperties[], addProperties: INodeProperties[]): void {
let existingIndex: number;
for (const property of addProperties) {
existingIndex = mainProperties.findIndex(element => element.name === property.name);
if (existingIndex === -1) {
// Property does not exist yet, so add
mainProperties.push(property);
} else {
// Property exists already, so overwrite
mainProperties[existingIndex] = property;
}
}
}