mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 14:44:05 -08:00
🔀 Merge branch 'TMaYaD-mux'
This commit is contained in:
commit
f6c9669cbf
|
@ -51,6 +51,11 @@ export class Merge implements INodeType {
|
||||||
value: 'mergeByKey',
|
value: 'mergeByKey',
|
||||||
description: 'Merges data of both inputs. The output will contain items of input 1 merged with data of input 2. Merge happens depending on a defined key.',
|
description: 'Merges data of both inputs. The output will contain items of input 1 merged with data of input 2. Merge happens depending on a defined key.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Multiplex',
|
||||||
|
value: 'multiplex',
|
||||||
|
description: 'Merges each value of one input with each value of the other input. The output will contain (m * n) items where (m) and (n) are lengths of the inputs.'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Pass-through',
|
name: 'Pass-through',
|
||||||
value: 'passThrough',
|
value: 'passThrough',
|
||||||
|
@ -254,6 +259,23 @@ export class Merge implements INodeType {
|
||||||
|
|
||||||
returnData.push(newItem);
|
returnData.push(newItem);
|
||||||
}
|
}
|
||||||
|
} else if (mode === 'multiplex') {
|
||||||
|
const dataInput1 = this.getInputData(0);
|
||||||
|
const dataInput2 = this.getInputData(1);
|
||||||
|
|
||||||
|
if (!dataInput1 || !dataInput2) {
|
||||||
|
return [returnData];
|
||||||
|
}
|
||||||
|
|
||||||
|
let entry1: INodeExecutionData;
|
||||||
|
let entry2: INodeExecutionData;
|
||||||
|
|
||||||
|
for (entry1 of dataInput1) {
|
||||||
|
for (entry2 of dataInput2) {
|
||||||
|
returnData.push({json: {...(entry1.json), ...(entry2.json)}});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [returnData];
|
||||||
} else if (['keepKeyMatches', 'mergeByKey', 'removeKeyMatches'].includes(mode)) {
|
} else if (['keepKeyMatches', 'mergeByKey', 'removeKeyMatches'].includes(mode)) {
|
||||||
const dataInput1 = this.getInputData(0);
|
const dataInput1 = this.getInputData(0);
|
||||||
if (!dataInput1) {
|
if (!dataInput1) {
|
||||||
|
|
Loading…
Reference in a new issue