aboutsummaryrefslogtreecommitdiffhomepage
path: root/common
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-03-15 13:12:25 +0100
committerBjørn Erik Pedersen <[email protected]>2024-03-15 16:45:53 +0100
commitb40f3c7df6bc89efaaadddec7d2cc291557b2ee9 (patch)
tree462c47ca383bf09a9c1c7f57c42793cb1072c0ad /common
parent57206e72749966f36c6e731c3f5ce7d9b5b11464 (diff)
downloadhugo-b40f3c7df6bc89efaaadddec7d2cc291557b2ee9.tar.gz
hugo-b40f3c7df6bc89efaaadddec7d2cc291557b2ee9.zip
Fix intersect and similar for term entry page collections
Fixes #12254
Diffstat (limited to 'common')
-rw-r--r--common/types/types.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/types/types.go b/common/types/types.go
index 801c511a0..e3850ddac 100644
--- a/common/types/types.go
+++ b/common/types/types.go
@@ -99,6 +99,14 @@ type Unwrapper interface {
Unwrapv() any
}
+// Unwrap returns the underlying value of v if it implements Unwrapper, otherwise v is returned.
+func Unwrapv(v any) any {
+ if u, ok := v.(Unwrapper); ok {
+ return u.Unwrapv()
+ }
+ return v
+}
+
// LowHigh is typically used to represent a slice boundary.
type LowHigh struct {
Low int