package hreflect
import "github.com/gohugoio/hugo/common/hreflect"
Package hreflect contains reflect helpers.
Index ¶
- Variables
- func GetMethodByName(v reflect.Value, name string) reflect.Value
- func GetMethodIndexByName(tp reflect.Type, name string) int
- func IsFloat(kind reflect.Kind) bool
- func IsInt(kind reflect.Kind) bool
- func IsNumber(kind reflect.Kind) bool
- func IsTruthful(in any) bool
- func IsTruthfulValue(val reflect.Value) (truth bool)
- func IsUint(kind reflect.Kind) bool
Variables ¶
Functions ¶
func GetMethodByName ¶
GetMethodByName is the same as reflect.Value.MethodByName, but it caches the type lookup.
func GetMethodIndexByName ¶
GetMethodIndexByName returns the index of the method with the given name, or -1 if no such method exists.
func IsFloat ¶
IsFloat returns whether the given kind is a float.
func IsInt ¶
IsInt returns whether the given kind is an int.
func IsNumber ¶
TODO(bep) replace the private versions in /tpl with these. IsNumber returns whether the given kind is a number.
func IsTruthful ¶
IsTruthful returns whether in represents a truthful value. See IsTruthfulValue
func IsTruthfulValue ¶
IsTruthfulValue returns whether the given value has a meaningful truth value. This is based on template.IsTrue in Go's stdlib, but also considers IsZero and any interface value will be unwrapped before it's considered for truthfulness.
func IsUint ¶
IsUint returns whether the given kind is an uint.
Source Files ¶
- Version
- v0.97.0
- Published
- Apr 13, 2022
- Platform
- darwin/amd64
- Imports
- 4 packages
- Last checked
- 51 minutes ago –
Tools for package owners.