package compare
import "github.com/gohugoio/hugo/compare"
Index ¶
- func Eq(v1, v2 any) bool
- func LessStrings(s, t string) bool
- func ProbablyEq(v1, v2 any) bool
- func Strings(s, t string) int
- type Comparer
- type Eqer
- type ProbablyEqer
Functions ¶
func Eq ¶
Eq returns whether v1 is equal to v2. It will use the Eqer interface if implemented, which defines equals when two value are interchangeable in the Hugo templates.
func LessStrings ¶
LessStrings returns whether s is less than t lexicographically.
func ProbablyEq ¶
ProbablyEq returns whether v1 is probably equal to v2.
func Strings ¶
Strings returns an integer comparing two strings lexicographically.
Types ¶
type Comparer ¶
Comparer can be used to compare two values. This will be used when using the le, ge etc. operators in the templates. Compare returns -1 if the given version is less than, 0 if equal and 1 if greater than the running version.
type Eqer ¶
type Eqer interface { // Eq returns whether this value is equal to the other. // This is for internal use. Eq(other any) bool }
Eqer can be used to determine if this value is equal to the other. The semantics of equals is that the two value are interchangeable in the Hugo templates.
type ProbablyEqer ¶
ProbablyEqer is an equal check that may return false positives, but never a false negative.
Source Files ¶
- Version
- v0.144.2 (latest)
- Published
- Feb 19, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 13 hours ago –
Tools for package owners.