mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-05 03:45:41 +00:00
refactor: using slices.Contains to simplify the code
Signed-off-by: damuzhi0810 <rust@before.tech>
This commit is contained in:
parent
c34d3f7805
commit
b04cdeea7d
@ -3,6 +3,7 @@ package yqlib
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -95,12 +96,7 @@ func (f *Format) MatchesName(name string) bool {
|
|||||||
if f.FormalName == name {
|
if f.FormalName == name {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
for _, n := range f.Names {
|
return slices.Contains(f.Names, name)
|
||||||
if n == name {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Format) GetConfiguredEncoder() Encoder {
|
func (f *Format) GetConfiguredEncoder() Encoder {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user