mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
@@ -27,7 +27,7 @@ func init() {
|
||||
|
||||
ns := &internal.TemplateFuncsNamespace{
|
||||
Name: name,
|
||||
Context: func(args ...interface{}) (interface{}, error) { return ctx, nil },
|
||||
Context: func(args ...any) (any, error) { return ctx, nil },
|
||||
}
|
||||
|
||||
ns.AddMethodMapping(ctx.IsMap,
|
||||
|
@@ -26,11 +26,11 @@ func New() *Namespace {
|
||||
type Namespace struct{}
|
||||
|
||||
// IsMap reports whether v is a map.
|
||||
func (ns *Namespace) IsMap(v interface{}) bool {
|
||||
func (ns *Namespace) IsMap(v any) bool {
|
||||
return reflect.ValueOf(v).Kind() == reflect.Map
|
||||
}
|
||||
|
||||
// IsSlice reports whether v is a slice.
|
||||
func (ns *Namespace) IsSlice(v interface{}) bool {
|
||||
func (ns *Namespace) IsSlice(v any) bool {
|
||||
return reflect.ValueOf(v).Kind() == reflect.Slice
|
||||
}
|
||||
|
@@ -26,8 +26,8 @@ type tstNoStringer struct{}
|
||||
func TestIsMap(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
for _, test := range []struct {
|
||||
v interface{}
|
||||
expect interface{}
|
||||
v any
|
||||
expect any
|
||||
}{
|
||||
{map[int]int{1: 1}, true},
|
||||
{"foo", false},
|
||||
@@ -41,8 +41,8 @@ func TestIsMap(t *testing.T) {
|
||||
func TestIsSlice(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
for _, test := range []struct {
|
||||
v interface{}
|
||||
expect interface{}
|
||||
v any
|
||||
expect any
|
||||
}{
|
||||
{[]int{1, 2}, true},
|
||||
{"foo", false},
|
||||
|
Reference in New Issue
Block a user