Allow CollectionPath.Of on IRIs

This commit is contained in:
mariusor 2022-11-03 14:55:20 +01:00
parent 1ffdb48e69
commit 3f5197d77b
No known key found for this signature in database
GPG key ID: 35D8720425890EF7

View file

@ -106,9 +106,12 @@ func (t CollectionPath) IRI(i Item) IRI {
// Of gives us the property of the i Item that corresponds to the t CollectionPath type.
func (t CollectionPath) Of(i Item) Item {
if IsNil(i) || !i.IsObject() {
if IsNil(i) {
return nil
}
if IsIRI(i) {
return i.GetLink().AddPath(string(t))
}
var it Item
if OfActor.Contains(t) && ActorTypes.Contains(i.GetType()) {
OnActor(i, func(a *Actor) error {