Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

refactor: use slices.Contains to simplify code (#6069)

weifanglab9fae524221f9
diff --git a/internal/scheduler/parser.go b/internal/scheduler/parser.go
index 20e889d3a..16197343e 100644
--- a/internal/scheduler/parser.go
+++ b/internal/scheduler/parser.go
@@ -1,6 +1,7 @@
package scheduler
import (
+ "slices"
"strconv"
"strings"
"time"
@@ -208,12 +209,7 @@ type listMatcher struct {
}
func (m *listMatcher) matches(value int) bool {
- for _, v := range m.values {
- if v == value {
- return true
- }
- }
- return false
+ return slices.Contains(m.values, value)
}
// stepMatcher matches values at regular intervals.