diff options
author | 2024-02-24 14:12:07 +0100 | |
---|---|---|
committer | 2024-02-24 20:22:53 -0800 | |
commit | b48ad6dbfb31ce113313c3120fd98a19522da699 (patch) | |
tree | d436183fccd7e51d0c6e624bf0f61adb915e8f2c /internal/template/functions.go | |
parent | 2be5051b19a397eff187b2f458b0c8aeece4e83b (diff) | |
download | v2-b48ad6dbfb31ce113313c3120fd98a19522da699.tar.gz v2-b48ad6dbfb31ce113313c3120fd98a19522da699.tar.zst v2-b48ad6dbfb31ce113313c3120fd98a19522da699.zip |
Make use of go≥1.21 slices package instead of hand-rolled loops
This makes the code a tad smaller, moderner,
and maybe even marginally faster, yay!
Diffstat (limited to 'internal/template/functions.go')
-rw-r--r-- | internal/template/functions.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/internal/template/functions.go b/internal/template/functions.go index ef3ffd37..2db98420 100644 --- a/internal/template/functions.go +++ b/internal/template/functions.go @@ -8,6 +8,7 @@ import ( "html/template" "math" "net/mail" + "slices" "strings" "time" @@ -72,12 +73,7 @@ func (f *funcMap) Map() template.FuncMap { return link }, "mustBeProxyfied": func(mediaType string) bool { - for _, t := range config.Opts.ProxyMediaTypes() { - if t == mediaType { - return true - } - } - return false + return slices.Contains(config.Opts.ProxyMediaTypes(), mediaType) }, "domain": func(websiteURL string) string { return urllib.Domain(websiteURL) |