Back to godoc.org

Package hreflect

v0.74.3
Latest Go to latest

The latest major version is .

Published: Jul 23, 2020 | License: Apache-2.0 | Module: github.com/gohugoio/hugo

Overview

Package hreflect contains reflect helpers.

Index

func IsTruthful

func IsTruthful(in interface{}) bool

IsTruthful returns whether in represents a truthful value. See IsTruthfulValue

func IsTruthfulValue

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

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier