mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 00:54:06 -08:00
17 lines
458 B
TypeScript
17 lines
458 B
TypeScript
|
import type { IExecuteFunctions } from 'n8n-workflow';
|
||
|
|
||
|
export function getMetadataFiltersValues(
|
||
|
ctx: IExecuteFunctions,
|
||
|
itemIndex: number,
|
||
|
): Record<string, never> | undefined {
|
||
|
const metadata = ctx.getNodeParameter('options.metadata.metadataValues', itemIndex, []) as Array<{
|
||
|
name: string;
|
||
|
value: string;
|
||
|
}>;
|
||
|
if (metadata.length > 0) {
|
||
|
return metadata.reduce((acc, { name, value }) => ({ ...acc, [name]: value }), {});
|
||
|
}
|
||
|
|
||
|
return undefined;
|
||
|
}
|