Checking existence of a business object relationship

what’s the right way to check (via script) whether a particular relationship exists on a given business object?
I know it’s not this: debug(‘does alias exist’, Alias.getMetadata(‘aliases’));
but something like that?

This will give you the relationships of a business object:

const relationships = this.topic.getMetadata('relationships');

That returns an object where each relationship name is a key and value is the metadata about the relationship.