Skip to content

Commit

Permalink
Filter prefix tags
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmalloy committed May 27, 2022
1 parent 90f8917 commit 8bd2ab2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/app/util/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,16 @@ export function urlSummary(url: string) {
}

export function interestingTags(tags?: string[]): string[] {
return _.filter(tags, interestingTag);
return _.filter(_.filter(tags, interestingTag), value => !prefixTag(value, tags!));
}

export function prefixTag(tag: string, tags: string[]) {
if (tag.startsWith('_') || tag.startsWith('+')) return false;
for (const t of tags) {
if (t === tag) continue;
if (t.startsWith(tag)) return true;
}
return false;
}

export function interestingTag(tag: string) {
Expand Down

0 comments on commit 8bd2ab2

Please sign in to comment.