aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrr-2016-07-05 23:14:05 +0200
committerrr-2016-07-06 23:03:37 +0200
commit6140872cd904ed031a9508a7644c02b6d91b00a9 (patch)
tree73968bf8f493eec9d3b940d1cc1e0f0d5beabaf3
parentfccedc090f5996ea084503dd35eb25c5d7cd8cc1 (diff)
client/posts: add implications recursively
-rw-r--r--client/js/tags.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/client/js/tags.js b/client/js/tags.js
index ae91010..3d62640 100644
--- a/client/js/tags.js
+++ b/client/js/tags.js
@@ -90,9 +90,20 @@ function refreshExport() {
}
function getAllImplications(tagName) {
- const actualTag = getTagByName(tagName) || {};
- // TODO: recursive
- return actualTag.implications || [];
+ let implications = [];
+ let check = [tagName];
+ while (check.length) {
+ let tagName = check.pop();
+ const actualTag = getTagByName(tagName) || {};
+ for (let implication of actualTag.implications || []) {
+ if (implications.includes(implication)) {
+ continue;
+ }
+ implications.push(implication);
+ check.push(implication);
+ }
+ }
+ return Array.from(implications);
}
function getSuggestions(tagName) {

© 2015 - 2026 Jakob L. Kreuze