n8n-nodes-arubacentral
Version:
n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities
29 lines (25 loc) • 718 B
text/typescript
// helpers/deduplicate.ts
import { INodeProperties } from 'n8n-workflow';
/**
* Adds descriptions to a target array, avoiding duplicates
*
* @param target The target array to add descriptions to
* @param source The source array of descriptions to add
*/
export function addDescriptions(
target: INodeProperties[],
source: INodeProperties[] | undefined,
): void {
if (!Array.isArray(source) || source.length === 0) return;
source.forEach((item) => {
const exists = target.some(
(existing) =>
existing.name === item.name &&
existing.type === item.type &&
JSON.stringify(existing.displayOptions) === JSON.stringify(item.displayOptions),
);
if (!exists) {
target.push(item);
}
});
}