package compare
import "github.com/gohugoio/hugo/tpl/compare"
Index ¶
- type Namespace
- func New() *Namespace
- func (n *Namespace) Conditional(condition bool, a, b interface{}) interface{}
- func (*Namespace) Default(dflt interface{}, given ...interface{}) (interface{}, error)
- func (*Namespace) Eq(x, y interface{}) bool
- func (n *Namespace) Ge(a, b interface{}) bool
- func (n *Namespace) Gt(a, b interface{}) bool
- func (n *Namespace) Le(a, b interface{}) bool
- func (n *Namespace) Lt(a, b interface{}) bool
- func (n *Namespace) Ne(x, y interface{}) bool
Types ¶
type Namespace ¶
type Namespace struct { }
Namespace provides template functions for the "compare" namespace.
func New ¶
func New() *Namespace
New returns a new instance of the compare-namespaced template functions.
func (*Namespace) Conditional ¶
Conditional can be used as a ternary operator. It returns a if condition, else b.
func (*Namespace) Default ¶
Default checks whether a given value is set and returns a default value if it is not. "Set" in this context means non-zero for numeric types and times; non-zero length for strings, arrays, slices, and maps; any boolean or struct value; or non-nil for any other types.
func (*Namespace) Eq ¶
Eq returns the boolean truth of arg1 == arg2.
func (*Namespace) Ge ¶
Ge returns the boolean truth of arg1 >= arg2.
func (*Namespace) Gt ¶
Gt returns the boolean truth of arg1 > arg2.
func (*Namespace) Le ¶
Le returns the boolean truth of arg1 <= arg2.
func (*Namespace) Lt ¶
Lt returns the boolean truth of arg1 < arg2.
func (*Namespace) Ne ¶
Ne returns the boolean truth of arg1 != arg2.
Source Files ¶
- Version
- v0.40.2
- Published
- Apr 30, 2018
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 7 hours ago –
Tools for package owners.