mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
@@ -31,11 +31,11 @@ module.exports = function(RED) {
|
||||
try {
|
||||
var $ = cheerio.load(msg.payload);
|
||||
var pay = [];
|
||||
var count = 0;
|
||||
var count = 0;
|
||||
$(tag).each(function() {
|
||||
count++;
|
||||
});
|
||||
var index = 0;
|
||||
count++;
|
||||
});
|
||||
var index = 0;
|
||||
$(tag).each(function() {
|
||||
if (node.as === "multi") {
|
||||
var pay2 = null;
|
||||
@@ -46,13 +46,13 @@ module.exports = function(RED) {
|
||||
/* istanbul ignore else */
|
||||
if (pay2) {
|
||||
msg.payload = pay2;
|
||||
msg.parts = {
|
||||
id: msg._msgid,
|
||||
index: index,
|
||||
count: count,
|
||||
msg.parts = {
|
||||
id: msg._msgid,
|
||||
index: index,
|
||||
count: count,
|
||||
type: "string",
|
||||
ch: ""
|
||||
};
|
||||
};
|
||||
node.send(msg);
|
||||
}
|
||||
}
|
||||
@@ -62,13 +62,14 @@ module.exports = function(RED) {
|
||||
if (node.ret === "attr") { pay.push( this.attribs ); }
|
||||
//if (node.ret === "val") { pay.push( $(this).val() ); }
|
||||
}
|
||||
index++;
|
||||
index++;
|
||||
});
|
||||
if ((node.as === "single") && (pay.length !== 0)) {
|
||||
if (node.as === "single") { // Always return an array - even if blank
|
||||
msg.payload = pay;
|
||||
node.send(msg);
|
||||
}
|
||||
} catch (error) {
|
||||
}
|
||||
catch (error) {
|
||||
node.error(error.message,msg);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user