From 26023a903cc22130f96a50e6e09d205c412615da Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Wed, 26 Nov 2025 17:40:56 +0100 Subject: add package is --- is/comparable.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 is/comparable.go (limited to 'is/comparable.go') diff --git a/is/comparable.go b/is/comparable.go new file mode 100644 index 0000000..7d639d8 --- /dev/null +++ b/is/comparable.go @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: 2025 Stefan Majewsky +// SPDX-License-Identifier: Apache-2.0 + +package is + +// EqualTo(b)(a) is the same as a == b. +func EqualTo[T comparable](rhs T) func(T) bool { + return func(lhs T) bool { + return lhs == rhs + } +} + +// DifferentFrom(b)(a) is the same as a != b. +func DifferentFrom[T comparable](rhs T) func(T) bool { + return func(lhs T) bool { + return lhs != rhs + } +} -- cgit v1.2.3