From 2e823a90c8cabf4ec743df82dd0d19bebd8b1478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20P=C3=A4ssler?= Date: Sun, 28 Feb 2016 01:24:04 +0100 Subject: [PATCH] nodefilter: filter unknown nodes --- lib/filters/nodefilter.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/filters/nodefilter.js b/lib/filters/nodefilter.js index 920352d..319a71e 100644 --- a/lib/filters/nodefilter.js +++ b/lib/filters/nodefilter.js @@ -12,10 +12,11 @@ define([], function () { n.graph = {} n.graph.nodes = data.graph.nodes.filter( function (d) { - if (!d.node) - return true - - var r = filter(d.node) + var r + if (d.node) + r = filter(d.node) + else + r = filter({}) if (r) filteredIds.add(d.id) @@ -24,7 +25,7 @@ define([], function () { }) n.graph.links = data.graph.links.filter( function (d) { - return !d.sourceid || (filteredIds.has(d.source.id) && filteredIds.has(d.target.id)) + return filteredIds.has(d.source.id) && filteredIds.has(d.target.id) }) return n