diff --git a/nodes/core/logic/17-split.html b/nodes/core/logic/17-split.html
index f8efa6bfb..8aa53ea49 100644
--- a/nodes/core/logic/17-split.html
+++ b/nodes/core/logic/17-split.html
@@ -35,9 +35,9 @@
-
-
-
+
+
+
@@ -47,25 +47,54 @@
@@ -192,11 +236,10 @@
id
- an identifier for the group of messages
index
- the position within the group
count
- the total number of messages in the group
- type
- the type of message - string/array/object
- ch
- for a string, the character used to split
+ type
- the type of message - string/array/object/buffer
+ ch
- for a string or buffer, the data used to the split the message as either the string or an array of bytes
key
- for an object, the key of the property this message was created from
- len
- for an array, the length of each array section
-
+ len
- the length of each message when split using a fixed length value
complete
diff --git a/nodes/core/logic/17-split.js b/nodes/core/logic/17-split.js
index 2fa96b34e..1b96fd583 100644
--- a/nodes/core/logic/17-split.js
+++ b/nodes/core/logic/17-split.js
@@ -39,8 +39,7 @@ module.exports = function(RED) {
var node = this;
node.stream = n.stream;
node.spltType = n.spltType || "str";
- node.addname = n.addname || false;
- node.addfname = n.addfname;
+ node.addname = n.addname || "";
try {
if (node.spltType === "str") {
this.splt = (n.splt || "\\n").replace(/\\n/,"\n").replace(/\\r/,"\r").replace(/\\t/,"\t").replace(/\\e/,"\e").replace(/\\f/,"\f").replace(/\\0/,"\0");
@@ -78,6 +77,7 @@ module.exports = function(RED) {
msg.parts.type = "string";
if (node.spltType === "len") {
msg.parts.ch = "";
+ msg.parts.len = node.splt;
var count = msg.payload.length/node.splt;
if (Math.floor(count) !== count) {
count = Math.ceil(count);
@@ -145,7 +145,9 @@ module.exports = function(RED) {
for (var p in pay) {
if (pay.hasOwnProperty(p)) {
msg.payload = pay[p];
- if (node.addname === true) { msg[node.addfname] = p; }
+ if (node.addname !== "") {
+ msg[node.addname] = p;
+ }
msg.parts.key = p;
msg.parts.index = j;
msg.parts.count = l;
diff --git a/test/nodes/core/logic/17-split_spec.js b/test/nodes/core/logic/17-split_spec.js
index 71bfc0046..289ded95e 100644
--- a/test/nodes/core/logic/17-split_spec.js
+++ b/test/nodes/core/logic/17-split_spec.js
@@ -101,7 +101,7 @@ describe('SPLIT node', function() {
});
it('should split an object into pieces and overwrite their topics', function(done) {
- var flow = [{id:"sn1", type:"split", addname:true, addfname:"topic", wires:[["sn2"]]},
+ var flow = [{id:"sn1", type:"split", addname:"topic", wires:[["sn2"]]},
{id:"sn2", type:"helper"}];
helper.load(splitNode, flow, function() {
var sn1 = helper.getNode("sn1");