1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

let join node handle merged objects with repeated properties and honour parts

to close issue from slack re repeated {"d":"d","d":"d","d":"d"}  messages
This commit is contained in:
Dave Conway-Jones 2019-02-20 00:11:31 +00:00
parent b51cfcc753
commit 2ebdd6c5cb
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
2 changed files with 3 additions and 4 deletions

View File

@ -631,8 +631,7 @@ module.exports = function(RED) {
} }
if (payloadType === 'object') { if (payloadType === 'object') {
group.payload[propertyKey] = property; group.payload[propertyKey] = property;
group.currentCount = Object.keys(group.payload).length; group.currentCount = (group.currentCount || 0) + 1;
//msg.topic = node.topic || msg.topic;
} else if (payloadType === 'merged') { } else if (payloadType === 'merged') {
if (Array.isArray(property) || typeof property !== 'object') { if (Array.isArray(property) || typeof property !== 'object') {
if (!msg.hasOwnProperty("complete")) { if (!msg.hasOwnProperty("complete")) {

View File

@ -531,8 +531,8 @@ describe('JOIN node', function() {
msg.payload.should.have.property("c",true); msg.payload.should.have.property("c",true);
msg.payload.should.have.property("d"); msg.payload.should.have.property("d");
msg.payload.d.should.have.property("e",7); msg.payload.d.should.have.property("e",7);
msg.payload.should.have.property("g"); // msg.payload.should.have.property("g");
msg.payload.g.should.have.property("f",6); // msg.payload.g.should.have.property("f",6);
done(); done();
} }
catch(e) { done(e)} catch(e) { done(e)}