mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fix bad use of hasOwnProperty
on an Array
This commit is contained in:
parent
a67e89ee67
commit
39d8386e43
@ -2142,7 +2142,7 @@ RED.nodes = (function() {
|
|||||||
nodeZmap[recoveryWorkspace.id] = [];
|
nodeZmap[recoveryWorkspace.id] = [];
|
||||||
}
|
}
|
||||||
node.z = recoveryWorkspace.id;
|
node.z = recoveryWorkspace.id;
|
||||||
nodeZmap[recoveryWorkspace.id].push(node);
|
nodeZmap[node.z].push(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2385,14 +2385,14 @@ RED.nodes = (function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const newLinks = [];
|
const newLinks = [];
|
||||||
// Remap all wires and (Config) Node references
|
// Remap all Wires and (Config) Node references
|
||||||
for (const node of [...newNodes, ...newGroups]) {
|
for (const node of [...newNodes, ...newGroups]) {
|
||||||
if (node.wires) {
|
if (node.wires) {
|
||||||
for (const wiresGroup of node.wires) {
|
for (const wiresGroup of node.wires) {
|
||||||
const wires = Array.isArray(wiresGroup) ? wiresGroup : [wiresGroup];
|
const wires = Array.isArray(wiresGroup) ? wiresGroup : [wiresGroup];
|
||||||
wires.forEach(function (wire) {
|
wires.forEach(function (wire) {
|
||||||
// Skip if the wire is clinked to a non-existent node
|
// Skip if the wire is clinked to a non-existent node
|
||||||
// TODO: Add warning message? Add RED.nodes.node() for same workspace?
|
// TODO: Add warning message?
|
||||||
if (!nodeMap.hasOwnProperty(wire)) { return; }
|
if (!nodeMap.hasOwnProperty(wire)) { return; }
|
||||||
if (node.z === nodeMap[wire].z) {
|
if (node.z === nodeMap[wire].z) {
|
||||||
const link = { source: node, sourcePort: node.wires.indexOf(wiresGroup), target: nodeMap[wire] };
|
const link = { source: node, sourcePort: node.wires.indexOf(wiresGroup), target: nodeMap[wire] };
|
||||||
@ -2521,14 +2521,14 @@ RED.nodes = (function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
for (const index in newGroups) {
|
for (const index in newGroups) {
|
||||||
if (newGroups.hasOwnProperty(newGroups[index])) {
|
if (newGroups.indexOf(newGroups[index]) !== -1) {
|
||||||
newGroups[index] = addGroup(newGroups[index]);
|
newGroups[index] = addGroup(newGroups[index]);
|
||||||
nodeMap[newGroups[index].id] = newGroups[index];
|
nodeMap[newGroups[index].id] = newGroups[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const index in newJunctions) {
|
for (const index in newJunctions) {
|
||||||
if (newJunctions.hasOwnProperty(newJunctions[index])) {
|
if (newJunctions.indexOf(newJunctions[index]) !== -1) {
|
||||||
newJunctions[index] = addJunction(newJunctions[index]);
|
newJunctions[index] = addJunction(newJunctions[index]);
|
||||||
nodeMap[newJunctions[index].id] = newJunctions[index];
|
nodeMap[newJunctions[index].id] = newJunctions[index];
|
||||||
}
|
}
|
||||||
@ -2536,7 +2536,7 @@ RED.nodes = (function() {
|
|||||||
|
|
||||||
// Now the nodes have been fully updated, add them as Proxy.
|
// Now the nodes have been fully updated, add them as Proxy.
|
||||||
for (const index in newNodes) {
|
for (const index in newNodes) {
|
||||||
if (newNodes.hasOwnProperty(newNodes[index])) {
|
if (newNodes.indexOf(newNodes[index]) !== -1) {
|
||||||
newNodes[index] = addNode(newNodes[index]);
|
newNodes[index] = addNode(newNodes[index]);
|
||||||
nodeMap[newNodes[index].id] = newNodes[index];
|
nodeMap[newNodes[index].id] = newNodes[index];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user