1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

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!
This commit is contained in:
jvoisin 2024-02-24 14:12:07 +01:00 committed by Frédéric Guillot
parent 2be5051b19
commit b48ad6dbfb
2 changed files with 9 additions and 20 deletions

View file

@ -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)