We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 97f43f8 commit d5b89d5Copy full SHA for d5b89d5
internal/glance/widget-custom-api.go
@@ -543,6 +543,18 @@ var customAPITemplateFuncs = func() template.FuncMap {
543
"concat": func(items ...string) string {
544
return strings.Join(items, "")
545
},
546
+ "unique": func(key string, results []decoratedGJSONResult) []decoratedGJSONResult {
547
+ seen := make(map[string]struct{})
548
+ out := make([]decoratedGJSONResult, 0, len(results))
549
+ for _, result := range results {
550
+ val := result.String(key)
551
+ if _, ok := seen[val]; !ok {
552
+ seen[val] = struct{}{}
553
+ out = append(out, result)
554
+ }
555
556
+ return out
557
+ },
558
}
559
560
for key, value := range globalTemplateFunctions {
0 commit comments