Compare commits

...

2 Commits

Author SHA1 Message Date
David Muthy
a70cda7fd5
Merge b04cdeea7d into d74e70104f 2025-02-24 08:15:49 +01:00
damuzhi0810
b04cdeea7d refactor: using slices.Contains to simplify the code
Signed-off-by: damuzhi0810 <rust@before.tech>
2025-01-23 23:32:10 +08:00

View File

@ -3,6 +3,7 @@ package yqlib
import (
"fmt"
"path/filepath"
"slices"
"strings"
)
@ -95,12 +96,7 @@ func (f *Format) MatchesName(name string) bool {
if f.FormalName == name {
return true
}
for _, n := range f.Names {
if n == name {
return true
}
}
return false
return slices.Contains(f.Names, name)
}
func (f *Format) GetConfiguredEncoder() Encoder {