diff options
| author | ewy <ewy0@protonmail.com> | 2026-04-22 21:02:44 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-04-22 21:02:44 +0200 |
| commit | 7f29f43fe2022671cc66502acb5e6d95eb777bc0 (patch) | |
| tree | 1541ef56be13c15e628620b481c5a818f41cda4b /identity/identity.go | |
| parent | 35fd641be06ed0e79ed995f685f40fec8fc57504 (diff) | |
add tests for identities
Diffstat (limited to 'identity/identity.go')
| -rw-r--r-- | identity/identity.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/identity/identity.go b/identity/identity.go index 1ae13c6..06bd421 100644 --- a/identity/identity.go +++ b/identity/identity.go @@ -7,6 +7,10 @@ type Identity struct { Reduced string } +func (i Identity) I(other Identity) bool { + return i.Reduced == other.Reduced +} + func (i Identity) Is(input string) bool { reduced := Reduce(input) return i.Reduced == reduced @@ -23,6 +27,7 @@ func New(input string) Identity { func Reduce(input string) string { reduced := input + reduced = strings.TrimPrefix(input, ".") if !strings.HasPrefix(reduced, ".") { reduced = strings.Split(reduced, ".")[0] } |
