diff --git a/ideaweb/graph.mjs b/ideaweb/graph.mjs index 0e0afbc..a8ec878 100644 --- a/ideaweb/graph.mjs +++ b/ideaweb/graph.mjs @@ -34,4 +34,13 @@ export default class Graph { addLink(source, target) { this.links.push({ source, target }); } + + *search(q) { + const re = new RegExp(q, "i"); + for (let n of this.nodes) { + if (re.test(n.name)) { + yield n; + } + } + } } diff --git a/ideaweb/index.html b/ideaweb/index.html index 7863b5b..2ccd29a 100644 --- a/ideaweb/index.html +++ b/ideaweb/index.html @@ -6,8 +6,6 @@ + + +