diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2025-11-26 17:40:56 +0100 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2025-11-26 17:54:09 +0100 |
| commit | 26023a903cc22130f96a50e6e09d205c412615da (patch) | |
| tree | 1d4bf882a78978d6edb1f3b1f60d1f1f04b4e085 /is/comparable.go | |
| parent | 3f447c28466911e234d421eb7e3310e14c30dfa9 (diff) | |
| download | go-gg-26023a903cc22130f96a50e6e09d205c412615da.tar.gz | |
add package is
Diffstat (limited to 'is/comparable.go')
| -rw-r--r-- | is/comparable.go | 18 |
1 files changed, 18 insertions, 0 deletions
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 <majewsky@gmx.net> +// 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 + } +} |
