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

tidy up split node to remove todo comments

This commit is contained in:
Dave Conway-Jones 2017-06-24 12:09:52 +01:00
parent bc472eb0b3
commit e23354b2bb
No known key found for this signature in database
GPG Key ID: 81B04231572A9A2D
2 changed files with 1 additions and 12 deletions

View File

@ -80,8 +80,6 @@ module.exports = function(RED) {
msg.parts.ch = ""; msg.parts.ch = "";
var count = msg.payload.length/node.splt; var count = msg.payload.length/node.splt;
if (Math.floor(count) !== count) { if (Math.floor(count) !== count) {
// Partial last packet
//TODO stream support
count = Math.ceil(count); count = Math.ceil(count);
} }
if (node.stream !== true) { if (node.stream !== true) {
@ -123,8 +121,6 @@ module.exports = function(RED) {
msg.parts.type = "array"; msg.parts.type = "array";
var count = msg.payload.length/node.arraySplt; var count = msg.payload.length/node.arraySplt;
if (Math.floor(count) !== count) { if (Math.floor(count) !== count) {
// Partial last packet
//TODO stream support
count = Math.ceil(count); count = Math.ceil(count);
} }
msg.parts.count = count; msg.parts.count = count;
@ -165,8 +161,6 @@ module.exports = function(RED) {
if (node.spltType === "len") { if (node.spltType === "len") {
var count = buff.length/node.splt; var count = buff.length/node.splt;
if (Math.floor(count) !== count) { if (Math.floor(count) !== count) {
// Partial last packet
//TODO stream support
count = Math.ceil(count); count = Math.ceil(count);
} }
if (node.stream !== true) { if (node.stream !== true) {
@ -203,10 +197,7 @@ module.exports = function(RED) {
end = pos+node.splt.length; end = pos+node.splt.length;
pos = buff.indexOf(node.splt,end); pos = buff.indexOf(node.splt,end);
} }
//TODO: stream support count++;
// if (end < msg.payload.length) {
count++;
// }
if (node.stream !== true) { if (node.stream !== true) {
msg.parts.count = count; msg.parts.count = count;
node.c = 0; node.c = 0;
@ -222,7 +213,6 @@ module.exports = function(RED) {
pos = buff.indexOf(node.splt,p); pos = buff.indexOf(node.splt,p);
} }
if ((node.stream !== true) && (p < buff.length)) { if ((node.stream !== true) && (p < buff.length)) {
// TODO: stream support;
msg.payload = buff.slice(p,buff.length); msg.payload = buff.slice(p,buff.length);
msg.parts.index = node.c++; msg.parts.index = node.c++;
msg.parts.count = node.c++; msg.parts.count = node.c++;

View File

@ -627,5 +627,4 @@ describe('JOIN node', function() {
}); });
}) })
}); });