hugo: github.com/gohugoio/hugo/common/hreflect Index | Files

package hreflect

import "github.com/gohugoio/hugo/common/hreflect"

Package hreflect contains reflect helpers.

Index

Package Files

helpers.go

func IsFloat Uses

func IsFloat(kind reflect.Kind) bool

IsFloat returns whether the given kind is a float.

func IsInt Uses

func IsInt(kind reflect.Kind) bool

IsInt returns whether the given kind is an int.

func IsNumber Uses

func IsNumber(kind reflect.Kind) bool

TODO(bep) replace the private versions in /tpl with these. IsInt returns whether the given kind is a number.

func IsTruthful Uses

func IsTruthful(in interface{}) bool

IsTruthful returns whether in represents a truthful value. See IsTruthfulValue

func IsTruthfulValue Uses

func IsTruthfulValue(val reflect.Value) (truth bool)

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.

Based on: https://github.com/golang/go/blob/178a2c42254166cffed1b25fb1d3c7a5727cada6/src/text/template/exec.go#L306

func IsUint Uses

func IsUint(kind reflect.Kind) bool

IsUint returns whether the given kind is an uint.

Package hreflect imports 2 packages (graph) and is imported by 27 packages. Updated 2020-09-30. Refresh now. Tools for package owners.